| title | Keyboard Accessibility Best Practices |
|---|
This document defines project-level expectations for keyboard operability.
All interactive functionality must be fully usable with a keyboard alone, without requiring a mouse or touch input.
- Every focusable control must show a clear, persistent visible focus indicator.
- Never remove focus outlines unless replacing them with an equally visible style.
- Focus indicators must meet WCAG contrast requirements against adjacent colors.
- Focus order must follow a logical reading and interaction sequence.
- Use semantic DOM order before relying on positive
tabindexvalues. - Avoid positive
tabindexwhenever possible.
- Use native interactive elements (
button,a,input,select,textarea) whenever possible. - Custom controls must expose equivalent keyboard behavior and ARIA semantics.
- Click handlers on non-interactive elements are not sufficient by themselves.
EnterandSpacemust activate the control.
Entermust activate the link.
- Must follow WAI-ARIA Authoring Practices keyboard patterns.
- Arrow key behavior must be documented and consistent.
- Move focus into the dialog on open.
- Trap focus while open.
Escapecloses when appropriate.- Restore focus to the triggering element on close.
- Provide a visible-on-focus skip link to main content.
- Use landmark regions (
header,nav,main,aside,footer) appropriately.
7. Disabled, Hidden, and Offscreen Content
- Disabled controls should not be focusable unless intentionally discoverable.
- Hidden content must not remain in the tab order.
- Offscreen techniques must not create focus traps or focus loss.
Minimum manual checks for each UI change:
- Tab from page start to end and verify logical order.
- Verify visible focus on each focusable element.
- Verify activation keys for all interactive controls.
- Verify no keyboard trap exists.
- Verify dialog open/close focus management.
- Enforce keyboard-related rules in linting and CI where possible.
- Automated checks do not replace manual keyboard walkthroughs.
A feature is not complete unless:
- Keyboard navigation is fully functional.
- Focus behavior is predictable and visible.
- Interaction patterns match expected standards.
- Manual keyboard test passes.
For AI systems and automated tooling, see wai-yaml-ld for structured accessibility standards:
- WCAG 2.2 (YAML) - Machine-readable WCAG 2.2 normative content including keyboard-related success criteria
- ARIA Informative (YAML) - ARIA keyboard interaction patterns and roles
- HTML Living Standard Accessibility (YAML) - HTML element keyboard behavior
- Standards Link Graph (YAML) - Relationships across WCAG/ARIA/HTML keyboard standards