Component request: accessible navigation
See original GitHub issueWhat’s the issue?
I’m trying to create an AMP-compatible (i.e. non-JavaScript) desktop navigation with submenus which open on hover and on focus (for keyboard accessibility).
When I struggled to build this, I looked at the https://ampbyexample.com site to see how they solved it - and it turns out their desktop navigation isn’t accessible either!
Could we extend the amp-sidebar component so that it can be used on desktop without toggle? Or else, build a desktop-menu
component?
How do we reproduce the issue?
This is the navigation on hover (as expected):

And this is the navigation when I try to access the submenu via keyboard tabbing:

In other words, I cannot navigate the site on a desktop if I am a keyboard-only user.
What browsers are affected?
N/A
Which AMP version is affected?
N/A
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Menu Structure | Web Accessibility Initiative (WAI) - W3C
Such structural information allows assistive technologies to announce the number of items in the menu and provide corresponding navigation functionality.
Read more >A Complete Guide To Accessible Front-End Components
An up-to-date collection of accessible front-end components: accordions, form styles, dark mode, data charts, date pickers, form styles, ...
Read more >Navigation | Accessibility Guidelines
Navigation is the way users find and traverse the different pages available on your site. For this reason, it is imperative that navigation...
Read more >Accessibility of the navigation menu of web application
The navigation menu is always one of the critical parts of the web application as it defines the overall structure of web applications...
Read more >Building an accessible menubar component using React
Libraries that provide a menubar component using React out of the box are rare. This article breaks down how to create one.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Some related feedback from @Jessman5
I was reading up on UX research on menus recently. There was advice like “hover should not reveal menu immediately to stop page flicker when mouse moves across screen - there should be a delay”, but there was an interesting discussion on submenus. I am sure you have all experienced a submenu where you hover, the submenu appears, and you have to move your mouse exactly horizontally sideways to get onto the submenu, then vertically to make your selection. If you go on a diagonal the submenu disappears. It appears the better solutions are once the submenu appears draw diagonal lines from the current menu item bounding box up to the bounding box of the submenu and if the mouse stays in that region, keep the submenu open. Then the mouse can move in a straight line from the current point on a menu item to the submenu item without it disappearing, no matter what it goes over.
There is another pattern which is menus are on every page, can be large (for good UX reasons) and so the weight of the markup matters. So you want to be able to express a mega-menu with fairly lightweight HTML markup (needs to be crawlable by search engines for SEO reasons).
This advanced sort of functionality combined with accessibility and trying to keep the markup as lightweight HTML seems potentially worthy of an AMP component?