question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Component request: accessible navigation

See original GitHub issue

What’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):

screen shot 2017-12-29 at 05 46 04

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

screen shot 2017-12-29 at 05 49 08

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:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
aghassemicommented, Jul 8, 2019

Some related feedback from @Jessman5

I personally am not happy with how you have to build a main-navigation with AMP when the amp-sidebar is not what you want. I’m currently working for http://chefkoch.de and we’ve built the main navigation just with <button>'s and <nav>'s and basically (sorry:) fucked around with amp states. (see here: https://www.chefkoch.de/rs/s0/bacon/Rezepte.html …) The result is everything but not accessible, sadly. If you have to use the keyboard to navigate through the site, you’re lost because our navigation is huge… this yould be easy with plain js but since it’s not allowed thats the best we could code till now. If you have another IDea for this, it is very much appreciated. Otherwise we’re excited to see a new module for a horizontal navigation that can be responsive for mobile views.

1reaction
alankentcommented, Jul 3, 2019

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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found