A menu is appropriate when requiring a partial page re-render without using a form or full page reload. For example: filtering and sorting of search results.
You can take a look at the menu pattern in action on our examples site.
You can get a quick idea of the required markup structure by viewing our bones project.
menu: the pattern as a whole, comprising the parts listed below
command list: the list of menu items
command: the individual menu item, menu item checkbox or menu item radio commands
On desktop, a menu is typically opened with a menu button. On mobile it is common to see a menu embedded directly inside of a filter or refine panel.
Adding, modifying or deleting records (e.g. CRUD) could be considered critical functionality. Filtering and sorting search results could be considered non-critical.
Selecting a command should not fully reload the page (use a fake menu instead).
This section provides interaction design for keyboard, screen reader & pointing devices.
The menu itself does not receive focus; focus must go to the first item in the menu.
DOWN-ARROW keys must navigate keyboard focus through commands via roving tabindex mechanism.
If focus is on a command,
SPACEBAR keys must activate that command.
TAB key must move keyboard focus off menu, and onto next interactive element in the page.
Commands must be announced as "menu item", "menu item radio" or "menu item checkbox" role.
Checkbox and radio command state must be announced as checked or unchecked.
Clicking any menu item must activate that command.
Please see the menu button pattern pattern. A menu is identical except for the lack of a button.
makeup-roving-tabindex - Useful for implementing the arrow key behaviour to change menu items
This section gives an overview of our use of ARIA, within the specific context of the menu pattern.
Informs assistive technology that this is a menu containing menuitems, menuitemradios or menuitemcheckboxes.
Informs assistive technology that the divs around groups of menu items are for presentation purposes only and should not be added to accessibility tree.
Informs assistive technology that this menu command has button behaviour.
Informs assistive technology that this menu command has radio button behaviour.
Informs assistive technology that this menu command has checkbox behaviour.
Informs assistive technology whether the menuitemradio or menuitemcheckbox is checked or not. Notice we do not use aria-selected.