# Keyboard Accessibility

Keyboard accessibility enables every interactive function to be reached and operated through keyboard input without traps or pointer-only actions.

- Type: practice
- Domain: Experience & interface
- Level: Intermediate
- Last reviewed: 2026-09-21
- Original: [Soroush’s Product Wiki](<https://wiki.soroush.uk/topic/keyboard-accessibility/>)

## What it means

Keyboard-accessible interfaces provide a logical path among controls, visible focus, expected keystrokes, and a way to leave every component. Native HTML controls supply much of this behavior; custom widgets must deliberately reproduce the relevant keyboard conventions and semantics.

## Why it matters

People with motor or visual disabilities may rely on keyboards, switches, voice input, or other technologies that generate keystrokes. Keyboard testing also exposes missing semantics, hidden controls, focus bugs, and interactions coupled incorrectly to a mouse or touch gesture.

## When to use it

Test keyboard access for every flow and after changes to navigation, overlays, drag-and-drop, custom controls, shortcuts, or dynamic content. Include both sequential Tab navigation and component-specific keys such as arrows, Escape, Enter, and Space.

## How it works

1. Start with semantic native controls and meaningful DOM order.
2. Ensure all actions have keyboard equivalents that do not require timed keystrokes.
3. Use Tab and Shift+Tab between components and conventional keys within composite widgets.
4. Keep focus visible and never create a keyboard trap.
5. Provide alternatives for pointer gestures such as dragging or path-based movement.
6. Test complete tasks using only a keyboard and document custom commands.

## A practical example

A sortable task list supports arrow-key movement plus explicit “Move up” and “Move down” buttons, announces the new position, and preserves focus on the moved item. A user can complete the task without reproducing a drag gesture.

## Where it breaks

Keyboard operation alone does not ensure useful semantics or a good screen-reader experience. Custom widgets can technically respond to keys while violating established expectations, and shortcuts may conflict with browsers, operating systems, or assistive technology.

## Common mistakes

- Adding tabindex="0" to noninteractive elements without implementing behavior.
- Using positive tabindex values to force a fragile order.
- Removing focus outlines without a strong replacement.
- Testing Tab navigation but not activation, Escape, arrows, or focus return.

## Visualization

[View the visualization on the website](<https://wiki.soroush.uk/topic/keyboard-accessibility/#visualization-keyboard-accessibility>)

## Sources

1. [Understanding Guideline 2.1: Keyboard Accessible](<https://www.w3.org/WAI/WCAG22/Understanding/keyboard-accessible.html>) — W3C Web Accessibility Initiative · Standards guidance
2. [Developing a Keyboard Interface](<https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/>) — W3C Web Accessibility Initiative · Technical guidance
3. [Understanding Success Criterion 2.4.3: Focus Order](<https://www.w3.org/WAI/WCAG22/Understanding/focus-order>) — W3C Web Accessibility Initiative · Standards guidance

## Related topics

- [Focus Management](<https://wiki.soroush.uk/topic/focus-management/>)
- [Screen Reader Design](<https://wiki.soroush.uk/topic/screen-reader-design/>)
- [WCAG](<https://wiki.soroush.uk/topic/wcag/>)
