-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Throw ElementError
when the menu of the header is missing but a toggle is present
#4206
Conversation
📋 StatsFile sizes
Modules
View stats and visualisations on the review app Action run for 827ba90 |
packages/govuk-frontend/src/govuk/components/header/header.test.js
Outdated
Show resolved
Hide resolved
ElementError
when the menu of the header is absent.
9b0f02d
to
05d7d97
Compare
f87a21e
to
ba4cf7f
Compare
090e1b6
to
655af8f
Compare
05d7d97
to
c50d078
Compare
c50d078
to
a166ded
Compare
6bbf0a4
to
9c4fa4d
Compare
a166ded
to
6bbf0a4
Compare
7660f03
to
50b3772
Compare
50b3772
to
7388b1c
Compare
We need to keep the early return if the toggle is absent, as it's not mandatory for the header to have a navigation. It could be good useful to expand the validations a little there and verify: - the presence of an `aria-controls` attribute on the `$menuButton` - the case where a menu is present, but no toggle This is outside of the scope of this PR, whose aim is to throw where v4 would return early. Closes #4130
4ae36ea
to
d41d913
Compare
this.$menu = $menu | ||
this.$menuButton = $menuButton |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this
Helps the compiler out a lot (narrows the types down) when adding to class fields after the checks
Strict mode will no longer warn that they might be null
etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, but can you fix my daft previous suggestion? Sorry
155b05f
to
f4cbf73
Compare
f4cbf73
to
2241b64
Compare
2241b64
to
71c9f48
Compare
71c9f48
to
b3c970c
Compare
b3c970c
to
827ba90
Compare
We need to keep the early return if the toggle is absent, as it's not mandatory for the header to have a navigation.
Closes #4130