Add Accessibility Tags to Navigation
Closed this issue · 3 comments
Describe the bug
The main navigation is hidden on viewports less than 1024 pixels wide. The button responsible for displaying the main navigation on smaller screens lacks an accessible label or accessible pressed state.
To Reproduce
Check button accessible label:
- Load the homepage in Firefox
- Open the dev tools and Turn on Accessibility Features in the Accessibility tab
- Reduce the viewport to a width where the navigation is hidden and menu button displayed
- Right click on the menu button selecting Inspect Accessibility Properties
- Check the Name and Role of the button element
Check button states:
- Continued from above
- Reveal the states in the properties panel in the right of the Accessibility tab
- Click the menu button to reveal the navigation
- Re-check the listed states
Expected behavior
- The button role should be
pushbutton
- When the navigation is displayed the states ought to include
expanded
andexpandable
- When the navigation is hidden the states should not include
collapsed
andexpandable
To remedy
The existing title within the SVG can be used as an accessible label:
- Add a unique id to the title:
<title id="UNIQUE_ID">Menu…
- Use the id as a value in an aria attribute on the button
`<button aria-labelled-by="UNIQUE_ID" …
The toggle button role and expanded state may be applied by:
- Adding aria-expanded attribute to the button:
<button aria-expanded="true" …
- Toggle the value when the menu is open:
<button aria-expanded="false" …
Thanks @ollicle! Totally forgot about accessibility, like so many people probably as well. Agree that we should be better about this and at least get the navigation right.
I do like your idea of not hiding the navigation on mobile. Let's stick with the current one for now though, as the page is super new and the navigation will probably grow soon. Hope that makes sense.
@grantbdev I’m so sorry! Old me had the above wrong.
aria-pressed
should be aria-expanded
I have corrected the details above.