Problem
A menu opened from the keyboard does not take focus. Enter or Space on a menu button opens the menu and leaves focus on the button, so a screen reader announces that something opened and then reads nothing in it. In three of the menus the arrow keys then do nothing at all.
Found with Windows Narrator in Chrome while #306 was being checked. It is not caused by #306: every row below was measured on the build of main 0fbad79 (v0.14.0 · build 0fbad79), on that build's own deployment address, in a fresh browser profile, at 1280 px, in English.
Measured
| Menu button |
Enter / Space |
Arrow Down on the closed button |
Arrow Down once open |
End once open |
Escape |
| Templates |
opens, focus stays on the button |
does not open |
first item |
last item |
closes, focus on the button |
| Insert module |
opens, focus stays on the button |
does not open |
first item |
last item |
closes, focus on the button |
| File |
opens, focus stays on the button |
does not open |
first item |
last item |
closes, focus on the button |
| Data |
opens, focus stays on the button |
does not open |
nothing |
nothing |
closes, focus on the button |
| Settings |
opens, focus stays on the button |
does not open |
nothing |
nothing |
closes, focus on the button |
| Help |
opens, focus stays on the button |
does not open |
nothing |
nothing |
closes, focus on the button |
- All six popups declare
role="menu". The Settings popup declares it and holds no menuitem at all: its content is other controls.
- Templates, Insert module and File use the shared hook
src/ui/useMenuKeyboard.ts. Data, Settings and Help do not. The hook's own comment says it was kept away from Help, Settings, the toolbar overflow, Data and the Distribution menu because nobody had specified their behaviour. This issue is that specification.
- Not measured at this width or state, and part of the audit below: the toolbar overflow (
More actions), the Theme and Language controls inside Settings (each has its own arrow-key handling), and the export menu of the Distribution panel.
- Mobile, 390 px: the More sheet is a dialog named
More with eleven button rows and no menu roles. Opening it from the keyboard puts focus on its Close button, and Escape closes it and returns focus to the More button. It has no aria-modal.
Not a defect
Narrator does not speak a menu item when the mouse pointer rests on it. A screen reader follows keyboard focus and its own cursor, not the pointer; reading under the pointer is a setting of the screen reader.
What the pattern asks
The W3C menu button pattern: Enter or Space opens the menu and places focus on the first item. Arrow Down on the button may open the menu and focus the first item, and Arrow Up the last. Inside the menu the arrow keys move, Home and End jump, and Escape closes and returns focus to the button. https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/
Scope
One shared behaviour, audited across every menu. Not a patch for Insert module alone.
- Desktop: Templates, Insert module, File, Data, Settings, Help, the toolbar overflow, Theme, Language, and the Distribution panel's export menu.
- Mobile: the More sheet and every sheet it opens.
- For each one, decide what it is before giving it keys. A popup that declares
role="menu" must behave as a menu. One that holds form controls and no menu items, as Settings does, is not a menu and should not say it is.
- The behaviour lives in the shared hook, with one owner for each key, as it does today for Escape.
- Opening with the mouse keeps working as it does now.
Done when
- A table like the one above, measured again on the fixed build, has no cell that disagrees with the contract chosen for that menu.
- Automated tests cover every menu in the scope: opening with Enter and with Space, where focus lands, the arrow keys, Home and End, Escape and the return of focus.
- A real screen reader has been used. Windows Narrator at least: for each menu, what was heard on opening and on moving through the items is written down. Platforms that were not checked are listed as not checked. A test that reads the accessibility tree is a structural check and is not called a screen-reader test.
Registered only. Not started.
Problem
A menu opened from the keyboard does not take focus. Enter or Space on a menu button opens the menu and leaves focus on the button, so a screen reader announces that something opened and then reads nothing in it. In three of the menus the arrow keys then do nothing at all.
Found with Windows Narrator in Chrome while #306 was being checked. It is not caused by #306: every row below was measured on the build of
main 0fbad79(v0.14.0 · build 0fbad79), on that build's own deployment address, in a fresh browser profile, at 1280 px, in English.Measured
role="menu". The Settings popup declares it and holds nomenuitemat all: its content is other controls.src/ui/useMenuKeyboard.ts. Data, Settings and Help do not. The hook's own comment says it was kept away from Help, Settings, the toolbar overflow, Data and the Distribution menu because nobody had specified their behaviour. This issue is that specification.More actions), the Theme and Language controls inside Settings (each has its own arrow-key handling), and the export menu of the Distribution panel.Morewith eleven button rows and no menu roles. Opening it from the keyboard puts focus on its Close button, and Escape closes it and returns focus to the More button. It has noaria-modal.Not a defect
Narrator does not speak a menu item when the mouse pointer rests on it. A screen reader follows keyboard focus and its own cursor, not the pointer; reading under the pointer is a setting of the screen reader.
What the pattern asks
The W3C menu button pattern: Enter or Space opens the menu and places focus on the first item. Arrow Down on the button may open the menu and focus the first item, and Arrow Up the last. Inside the menu the arrow keys move, Home and End jump, and Escape closes and returns focus to the button. https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/
Scope
One shared behaviour, audited across every menu. Not a patch for Insert module alone.
role="menu"must behave as a menu. One that holds form controls and no menu items, as Settings does, is not a menu and should not say it is.Done when
Registered only. Not started.