Test your site by pressing Tab. Can you see where you are? Can you reach the menu, the search, the buttons and the form? Can you open and close everything? If not, some visitors cannot use your site at all.
Keys to test with
| Key | Expected behaviour |
|---|---|
| Tab / Shift+Tab | Move forward and back between interactive elements |
| Enter | Activate links and buttons |
| Space | Activate buttons, toggle checkboxes |
| Arrow keys | Move within menus, tabs, radio groups, sliders |
| Escape | Close dialogs, menus and popups |
Visible focus
:focus-visible {
outline: 3px solid #8f1418;
outline-offset: 2px;
border-radius: 4px;
}Make sure sticky headers do not cover the focused element (WCAG 2.2, see WCAG explained).
Skip link
<a class="skip" href="#main">Skip to content</a>
…
<main id="main">…</main>This site has one: press Tab on any page and it appears.
Use native elements
<a href>for navigation,<button>for actions – not clickable<div>s.- Native form controls instead of custom lookalikes.
<details>and<dialog>where they fit.
Common problems
- Dropdown menus that open on hover only (see accessible navigation).
- Modals that do not trap focus inside, or do not return focus when closed.
- Keyboard traps: focus gets stuck in an embedded widget.
- Focus order that jumps around because of CSS reordering.
- Carousels that cannot be paused or controlled.
Frequently asked questions
Why should I care about keyboard users?
People who are blind, have motor disabilities or use switch devices rely on keyboard-like navigation. Power users and people with temporary injuries benefit too.
Can I remove the focus outline because it looks ugly?
Never remove it without a clear replacement. Style it to fit your design instead – :focus-visible lets you show it only for keyboard users.