Menubar meets WCAG 2.2 level AA when used as described on these pages. It follows the Menu and Menubar pattern of the WAI-ARIA Authoring Practices.
Keyboard
| Key |
Action |
| Down, Up |
Move between items. Disabled items are skipped. |
| Home, End |
Move to the first or last item. |
| Enter |
Runs the item and closes the menu. On a checkbox or radio item, ticks it. |
| Space |
Same as Enter. |
| Right |
On a sub-menu trigger, opens the sub-menu and moves into it. |
| Left |
In a sub-menu, closes it and goes back to its trigger. |
| Esc |
Closes the menu. Focus goes back to where it was. |
| A letter |
Moves to the next item that starts with it. |
| Left, Right |
In the bar, move between menu names. With a menu open, open the next one. |
| Tab |
Leaves the bar. The bar is one stop in the tab order. |
role="menubar" on the bar; each menu name is a menuitem with aria-haspopup="menu" and aria-expanded.
role="menu" on the menu; menuitem, menuitemcheckbox with aria-checked, and menuitemradio on items; group on groups.
- Arrow keys, typing a letter, sub-menus and Esc, as in the table above.
- Disabled items stay in the reading order with
aria-disabled, in the disabled text colour.
- A visible focus outline on the menu name that has keyboard focus.
What your team does
- Name the bar when the page has more than one, with
aria-label.
- List the shortcuts shown in the menus where everyone can find them, and don’t take keys the browser or screen readers use.
WCAG criteria
| Criterion |
Level |
How |
| 1.4.1 Use of Color |
A |
The checked state is a check mark, not a colour |
| 2.1.1 Keyboard |
A |
Every item works with the keyboard |
| 2.4.7 Focus Visible |
AA |
The highlighted item has color.surface.overlay.hover |
| 4.1.2 Name, Role, Value |
A |
Menu roles, aria-checked, aria-expanded |