On this page

Context menu

Keys, what Context menu gives you and what your team does.

Conformance

Context menu meets WCAG 2.2 level AA when used as described on these pages. Its menu follows the Menu 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.
Shift + F10, or the Menu key On a focused trigger, opens the menu.

What Context menu gives you

  • Opens on right-click, on long-press, and on the keyboard keys that open a context menu.
  • 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.

What your team does

  • Make every action in the menu reachable another way too, such as a visible menu button. Right-click and long-press are hard to discover.
  • Make the trigger focusable (tabindex="0"), or put the menu on an element that already is, such as a row’s link.
  • Don’t put a context menu on text people may want to copy.

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
2.5.1 Pointer Gestures A Long-press has a single-tap alternative when the actions are also on a visible button