Implement focus management in main menu
See original GitHub issueIssue Summary
Tabbing through Wagtail’s main menu, it should be possible to move between all visible menu items one by one, opening submenus as required. Instead, users have to tab through submenus that are closed:
The correct behavior would be:
- When submenus aren’t open, users shouldn’t have to tab through their menu items.
- Submenus can be opened by clicking, pressing Enter while focused; and closed with the Esc key or clicking outside
- Opening a submenu, the focus now moves to the submenu and is trapped there until closed
- Submenu triggers should use
button
tags instead ofa
, so screen readers announce the correct behavior (button instead of link), and browsers do not display a link target of “#” (see #5349).
Steps to Reproduce
- Go to the Wagtail admin
- Navigate with a keyboard through the menu items
Related: #5336
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Focus management | Interface guidelines
Overview. Managing focus within a page or application is essential for users to successfully navigate, complete actions, and understand where they are.
Read more >Actions Menu Button Example Using element.focus() - W3C
focus () to set focus in response to events that trigger focus movement inside the menu. An alternative technique for managing focus movement ......
Read more >Focus management and inert | CSS-Tricks
Many forms of assistive technology use keyboard navigation to understand ... Focus management is the practice of coordinating what can and ...
Read more >Developer-driven focus management for single-page ... - Ad Hoc
Developer-driven focus management is determining keyboard focus after taking an action. This could include submitting a form, expanding a menu, ...
Read more >Web Accessibility: Aria, Focus, Focus Management - Telerik
The concept of focus management is really important in understanding how assistive technologies handle announcing elements in the DOM or even ...
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 FreeTop 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
Top GitHub Comments
@thibaudcolas I’m going to take the route of using
aria-expanded="false"
oraria-expanded="true"
to show the submenus, since the standard ARIA menu markup is meant for application menus (and not so much for navigation lists on web pages).@marteki is there an open PR for this issue ? I wanted to work on it, following your approach, but if part of the work has already been done here it could be helpful 😉