Navigation
Menu
A menu is a short list of actions that floats over the page from a button, such as a project's options: Edit project, Export payments, Leave project.
In kanso-ui as Menu
Accessibility
- Roles: the trigger is a
<button>with a name ("Project options"),aria-haspopup="menu",aria-expandedandaria-controls. The list isrole="menu", named by the trigger witharia-labelledby; each item is a<button role="menuitem">in anli role="none"; the separator isrole="separator". - Keyboard: Enter, Space or Down arrow on the trigger opens the menu on the first item, Up arrow on the last. Down and Up move between items and wrap; Home and End jump to the ends; Enter or Space runs the action and closes the menu. Escape closes it and returns focus to the trigger; Tab closes it and moves on.
- Shortcuts: show the keys in
k-menu__shortcut, hidden from screen readers, and expose them witharia-keyshortcuts. - Targets: items are 44px tall across the full menu width, above the 32px web minimum (
size-control-sm). - Contrast: labels,
inkonsurface, 17.4:1 in light and 14.4:1 in dark; icons and shortcuts,ink-mutedonsurface, 6.7:1 and 8.1:1; the critical item,criticalonsurface, 6.5:1 and 10.0:1. - Motion: the menu fades in and out over
--k-motion-medium(300ms); nothing slides. The hover layer fades in 150ms.