Keyboard Navigation
What is keyboard navigation and why must every element be reachable?
What is keyboard navigation?
Keyboard navigation means that every interactive element on a page — links, buttons, form fields, menus, and custom widgets — can be reached and operated using only the keyboard (typically via the Tab, Enter, Space, and arrow keys). This is a fundamental accessibility requirement because many users cannot use a mouse.
Keyboard navigation is the ability to reach and operate every interactive element on a page using only the keyboard, typically via Tab, Enter, Space, and arrow keys. This is a fundamental WCAG requirement because users with motor disabilities or visual impairments often cannot use a mouse.
Why does keyboard navigation matter?
Users with motor disabilities, repetitive strain injuries, or visual impairments often rely entirely on keyboard input. If a button or link can only be activated with a mouse click, those users are completely locked out. Keyboard traps (where focus gets stuck in a component with no way to Tab out) are especially harmful and represent a critical WCAG failure.
An estimated 2.5 billion people worldwide need one or more assistive technology products, many of whom rely on keyboard-only navigation.
67% of screen reader users reported that not all functionality being available via keyboard is one of the most problematic issues they encounter.
How to fix it
- Use native HTML interactive elements (<button>, <a>, <input>, <select>) whenever possible, since they have built-in keyboard support.
- If you must use non-interactive elements like <div> or <span> as buttons, add tabindex="0", a role attribute (e.g., role="button"), and keydown event handlers for Enter and Space keys.
- Test your entire site by unplugging your mouse and navigating with Tab, Shift+Tab, Enter, Space, and arrow keys. Ensure every interactive element is reachable and operable.
- Eliminate keyboard traps by ensuring users can always Tab or Escape out of any component, including modals, dropdown menus, and date pickers.
- Ensure the tab order follows a logical reading sequence (typically left-to-right, top-to-bottom) and avoid using positive tabindex values that override natural DOM order.
Frequently asked questions
What is a keyboard trap?
A keyboard trap occurs when a user can Tab into a component (such as a modal or widget) but cannot Tab or Escape out of it, leaving them stuck. This is a critical WCAG 2.1.2 failure.
Should I set tabindex on every element?
No. Native interactive elements like buttons and links are already in the tab order. Only use tabindex="0" on custom interactive widgets, and avoid positive tabindex values as they disrupt the natural tab order.
How do I test keyboard navigation quickly?
Unplug your mouse (or disable your trackpad) and try to complete every task on your page using only the keyboard. If you get stuck anywhere or cannot activate a control, you have a keyboard accessibility issue.
Related guides
Focus Management
Focus management controls which element on the page currently receives keyboard input, indicated by a visible focus ring or outline. Proper...
Read more → AccessibilityARIA Violations
ARIA (Accessible Rich Internet Applications) attributes provide extra semantic information to assistive technologies when native HTML elemen...
Read more → AccessibilityForm Labels
Form labels are HTML <label> elements that programmatically associate a text description with a form input (text field, checkbox, select, et...
Read more →Scan your site for accessibility issues
Find and fix these issues automatically with eiSEO.
50 pages free · No credit card · Results in under 2 minutes