Skip to content
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

Keyboard accessibility of the main nav menu: focus and order #12022

Open
3 tasks done
pepelsbey opened this issue Oct 23, 2024 · 0 comments
Open
3 tasks done

Keyboard accessibility of the main nav menu: focus and order #12022

pepelsbey opened this issue Oct 23, 2024 · 0 comments
Labels
idle needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened.

Comments

@pepelsbey
Copy link
Member

pepelsbey commented Oct 23, 2024

Summary

When navigated via keyboard, the main nav’s focus order is not visual and breaks the expectations: not so bad on desktop, much worse on mobile. On mobile, the user menu is not even reachable.

URL

https://developer.mozilla.org/en-US/

Reproduction steps

  1. Go to https://developer.mozilla.org/en-US/
  2. Start tabbing through main navigation
  3. Try to open collapsed menu items

Expected behavior

  • All menu items available via keyboard
  • Menu items focused in visual order

Actual behavior

  • On mobile, the user menu is not reachable
  • Menu items focused in random order, especially on mobile

Device

Desktop

Browser

Chrome

Browser version

Stable

Operating system

Android

Screenshot

In every case, I tab through the opened menu and back. On mobile, I also press space on focused elements to open them.

mobile.mov
desktop.mov

Anything else?

I’d suggest using two different markup structures for desktop and mobile views and display: none one of them depending on the viewport size. Until we have the reading-flow property, the DOM order is the king for the keyboard navigation. You can also listen to matchMedia when the viewport changes and reorder DOM but it’s not a good idea.

Validations

@github-actions github-actions bot added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Oct 23, 2024
@github-actions github-actions bot added the idle label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idle needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened.
Projects
None yet
Development

No branches or pull requests

1 participant