Skip to content

Keyboard & ARIA Patterns ​

This section details the explicit keyboard interaction contracts and WAI-ARIA state synchronization specifications for specific interactive UI components that exceed generic accessibility checklists.

Each pattern strictly adheres to the official W3C WAI-ARIA Authoring Practices Guide (APG). When designing bespoke components or handling complex edge cases, always consult the APG before inventing novel interaction contracts.

"No ARIA is better than Bad ARIA"

The fundamental principle of web accessibility states: No ARIA is better than Bad ARIA.

Never copy role attributes or aria-* tags onto markup without implementing the corresponding keyboard event loops and state synchronization scripts. Doing so announces an unfulfilled contract to assistive technologies—promising arrow key navigation or state changes that do not physically exist—creating severe usability barriers.

If a component's full behavioral lifecycle cannot be completely built, ship native HTML elements rather than cosmetic ARIA roles.

Do not add a role or aria-* attribute without implementing its keyboard interaction MUST NOTUI-R07
A role="tab" tells assistive technology that arrow keys work. When the keyboard interaction cannot be fully built, use a native element instead.
Check: UI-09UI-09 Role needs its keys✕ NGRole added, no key handlingRole="tab" is set but the arrow key does nothing✓ OKRole comes with its keysRole="tab" is set and the arrow key moves to the next tab

Search or filter the patterns below. Each card links to a comprehensive specification containing DOM anatomy, required ARIA attributes, complete JavaScript source code, and an interactive live demonstration:

  • Tabs

    A row of headings that switch between several panels.

  • Modal dialog

    A popup that takes over the whole screen — confirmations, delete prompts.

  • Menu button

    A list of actions opened from a button, like a "…" menu.

  • Combobox (autocomplete)

    A text field whose suggestions filter as you type.

  • Tooltip

    A short explanation that appears over an icon or control.

  • Toast (status message)

    A brief confirmation, like "Saved", that appears and disappears on its own.

Note: As new recurring patterns emerge across projects, propose them for inclusion in these centralized guidelines rather than creating bespoke solutions in isolation.