Guide
Keyboard Accessibility Basics
If a site works well with a keyboard alone, it is already a long way towards working for screen reader, switch and voice control users. Here is what to check.
Short answer: Keyboard accessibility means every link, button and control can be reached and used without a mouse, in a sensible order, with a visible focus indicator that is never hidden, and without getting stuck. WCAG covers this in criteria 2.1.1 Keyboard, 2.1.2 No Keyboard Trap, 2.4.3 Focus Order, 2.4.7 Focus Visible and, new in 2.2, 2.4.11 Focus Not Obscured.
Who relies on the keyboard
Keyboard access matters to more people than you might expect. People with tremors or limited hand movement may find a mouse impossible to control precisely. Screen reader users usually navigate with keyboard commands. Switch devices and many voice control tools work by sending keystrokes. Some people simply find the keyboard faster. When keyboard access breaks, all of these people are affected at once.
What WCAG asks for
Several success criteria cover keyboard use:[1]
- 2.1.1 Keyboard (A). All functionality of the content is operable through a keyboard interface, without requiring specific timings for individual keystrokes.
- 2.1.2 No Keyboard Trap (A). If keyboard focus can be moved to a component, focus can also be moved away from it using the keyboard.
- 2.4.3 Focus Order (A). Components receive focus in an order that preserves meaning and operability.
- 2.4.7 Focus Visible (AA). Any keyboard operable interface has a mode where the keyboard focus indicator is visible.
- 2.4.11 Focus Not Obscured (Minimum) (AA). When a component receives keyboard focus, it is not entirely hidden by author-created content.
Focus Not Obscured is one of the criteria added in WCAG 2.2.[2] It targets a very common modern problem: sticky headers, cookie banners and chat buttons that cover the element someone has just tabbed to.
Focus order
Pressing Tab should move through the page in the order people read it: usually left to right and top to bottom, through the header, the main content and the footer. Problems arise when the visual layout is rearranged with CSS but the code order is not, or when tabindex values greater than zero force an unnatural order. The fix is almost always to make the source order match the visual order and to avoid positive tabindex values.
Focus also needs to go somewhere sensible after an action. When a dialog opens, focus should move into it; when it closes, focus should return to the button that opened it. When a form reports errors, focus should move to the error summary.
Visible focus
The focus indicator is the keyboard user's cursor. Browsers draw one by default, but many sites remove it because designers find it untidy. That leaves keyboard users guessing where they are. A good focus style is thick enough to see, has at least 3 to 1 contrast against its surroundings, and is consistent across the site.[1] On this site focus is shown with a 3 pixel outline: near-black on light sections and lime on dark ones.
Using the :focus-visible selector in CSS lets you show a strong focus style for keyboard users without showing it on every mouse click, which removes the usual objection.
Keyboard traps
A trap is any component that focus can enter but not leave. Embedded video players, map widgets, some rich text editors and badly built modal dialogs are common culprits. The person is stuck and may have to reload the page, losing their work. Any embedded third-party component should be tested for traps before it goes live.
Skip links
A skip link is a link at the very start of the page, often hidden until it receives focus, that jumps straight to the main content. Without it, keyboard users must tab through the whole header and navigation on every page. It is a small feature that saves a great deal of effort. Press Tab once on this page and you will see ours.
Menus, tabs and other widgets
Native links, buttons and form controls are keyboard accessible by default. Custom widgets built from div elements are not, unless the developer adds keyboard handling, roles and states. Established patterns describe the expected keys: tabs move with the arrow keys, menus open with Enter or Space and close with Escape, and so on. Our keyboard demo lets you try a disclosure menu and a tab set built to those patterns.
Hover-only menus are a frequent failure. If a submenu opens only when the mouse hovers over it, keyboard users cannot reach the links inside. Make the parent a button that toggles the submenu.
A five-minute keyboard test
- Put the mouse away. Load the page and press Tab. Does a skip link appear first?
- Keep pressing Tab. Can you always see where focus is? Is it ever hidden behind a sticky header or banner?
- Does the order follow the page as you read it?
- Open the main menu, any dropdowns and any dialogs using Enter or Space. Can you close them with Escape?
- Try the main task on the page, such as searching or submitting a form. Can you finish it?
- Press Shift+Tab to go backwards. Do you ever get stuck?
If any step fails, you have found a barrier worth fixing. The full checklist includes these and other quick checks.
Keyboard problems in common website components
When testing, give these components extra attention. Dialogs and fixed bars are covered in the next section but one.
- Carousels and sliders with previous and next controls that are not buttons, or that move focus unexpectedly.
- Cookie banners that appear on top of the page but are not reachable first, or that trap focus until a choice is made with no keyboard route.
- Accordions and tabs built from links or plain elements without button roles or keyboard handling.
- Embedded content, such as video players, maps and booking widgets, which may trap focus or hide controls.
Writing keyboard requirements for developers
Developers can only build what is specified. For each interactive component, write down:
- which element receives focus first and the order of focus inside it;
- which keys do what, such as Enter or Space to open, arrows to move, Escape to close;
- where focus goes when the component opens and when it closes;
- how the component's state, such as expanded or selected, is exposed to assistive technology;
- what the focus indicator looks like on every background where the component appears.
Five lines like these in a design file help catch keyboard issues before an audit does.
Focus, dialogs and sticky content
Modal dialogs need careful keyboard handling. When a dialog opens, focus should move into it. While it is open, Tab should cycle through its controls rather than slipping into the page behind it. When it closes, focus should return to the control that opened it, so people do not lose their place. The Escape key should close it unless doing so would lose information.
Sticky headers, cookie banners, chat buttons and "back to top" links cause a quieter problem. As someone tabs down a page, the focused element can scroll underneath a fixed bar and disappear from view. WCAG 2.2 added 2.4.11 Focus Not Obscured (Minimum), which asks that a focused component is not entirely hidden by content the author has placed on the page.[1]
A quick test: tab through a long page with the cookie banner still showing and the header pinned, and check that you can always see where focus is.
Questions about keyboard access
Is it acceptable to remove focus outlines and add our own?
Yes, as long as your own style is clearly visible, has enough contrast and appears on every focusable element. Removing the outline with nothing in its place fails WCAG.
Do mobile sites need keyboard support?
Yes. People use external keyboards and switch devices with phones and tablets, and screen readers on mobile rely on the same structure.
What does tabindex="0" do?
It adds an element to the normal tab order. Use it sparingly, for custom controls that are not focusable by default. Avoid values above zero.
Sources
Sources checked on 3 November 2026.
- Standard. Web Content Accessibility Guidelines (WCAG) 2.2, W3C, W3C Recommendation, 12 December 2024 edition.
- Standard. What's New in WCAG 2.2, W3C Web Accessibility Initiative, checked 3 November 2026.