In short
Testing keyboard navigation means going through a page without a mouse, using Tab, Shift + Tab, Enter, Space, the arrow keys and Esc, and checking that you can reach everything, see everything and use everything. The check consists of running this test on the main templates and user journeys (home, listing, product page, form, cart), logging the issues in a grid, then fixing them. Expected result: a keyboard user always sees where they are, follows a logical order, opens menus and dialogs, and is never stuck.
Why it matters
Many people browse without a mouse: blind people using a screen reader, people with motor disabilities who use a keyboard, a switch or voice control, power users who prefer the keyboard. All these aids rely on the same mechanisms as the Tab key: if a menu only opens on hover, if a consent dialog holds on to focus, if focus is invisible, part of the site is closed to them.
The keyboard test also reveals construction flaws that affect crawlers and AI agents. An element reachable with the keyboard is almost always a real link, a real button or a real field; an element that cannot be reached is often a clickable <div>, which a crawler does not follow and a browsing agent struggles to identify. Agents that drive a browser on a user's behalf do not publish how they work in detail, but a site usable with the keyboard offers explicit, predictable controls, which makes their job easier.
Finally, the test is required by the standards: WCAG 2.1.1 (everything is operable with the keyboard), 2.1.2 (no keyboard trap), 2.4.3 (focus order), 2.4.7 (focus visible) and 2.4.11 (focus not obscured, added in WCAG 2.2), and in France RGAA (the French accessibility framework) criteria 7.3, 10.7, 12.7, 12.8 and 12.9.
What it improves
- Accessibility Full access for people who cannot use a mouse.
- Conversion Forms, filters and carts usable by everyone; keyboard blockers are often outright blockers on some devices.
- Code quality The test surfaces fake links and fake buttons, which are just as problematic for crawling.
- AI agents Reachable, identifiable controls. A plausible effect, poorly documented.
- Ranking No direct effect.
How to check
Set up your machine
- Windows and Linux: nothing to configure. Chrome, Edge and Firefox move through links, buttons and fields with
Tab. - macOS: turn on
System Settings > Keyboard > Keyboard navigation. In Safari, also turn on, in the Advanced settings, the option that lets the Tab key highlight each item on a webpage; without it,Tabskips links (Option + Tabreaches them). - Visual aids: in Firefox, the Accessibility Inspector offers a “Show Tabbing Order” checkbox, which numbers the tab stops on the page. Accessibility Insights for Web offers an equivalent visualization (“Tab stops”).
To find out where focus is when it is invisible, paste this into the developer tools console:
document.addEventListener('focusin', () => {
const el = document.activeElement;
console.log(el.tagName.toLowerCase(), el.getAttribute('aria-label') || el.textContent.trim().slice(0, 40), el);
});
Run the test
Start from the address bar, then:
- First
Tab: a “Skip to content” link should appear;Entermoves focus to the start of the main content. Tabto the end of the page, thenShift + Tabto go back: every interactive element is reached, in visual order, with a visible focus indicator that is not hidden by a sticky header or a banner.- Menus: a submenu opens with
EnterorSpaceon its button, can be navigated, and closes withEsc. - Modal dialogs and consent banner: focus moves into the dialog when it opens, stays there while it is open,
Esccloses it, and focus returns to the element that opened it. - Rich components: carousel (pause, next, previous), tabs, accordions, price sliders, date pickers, interactive maps.
- Forms: every field is reached, checkboxes and radio buttons are checked with
Space, lists are operated with the arrow keys, submission works withEnter, and focus moves to the first error message. - Full journey: adding to cart and starting checkout, booking an appointment, internal search.
The deliverable: the test grid
| Page | Step | Criterion | Expected result | Finding | Severity | Fix |
|---|---|---|---|---|---|---|
| Home | 1st Tab |
Skip link | visible, leads to the content | missing | medium | add to the layout |
| Home | “Products” menu | Submenu | opens with Enter, closes with Esc |
opens only on hover | blocking | aria-expanded button |
| Product page | size selector | Visible focus | clear outline | no outline | blocking | global :focus-visible |
| Product page | “Add to cart” | Order | after the size | reached before the price | low | fix the DOM order |
| All | cookie banner | Trap | Esc or a button closes it, focus restored |
focus stuck behind the banner | blocking | modal <dialog> |
| Contact | submission with an error | Focus management | focus on the first error | focus stays on the button | medium | move focus |
Classify as “blocking” anything that prevents completing a task: fix these first.
How to implement
Before you start
Most fixes come down to five rules that apply everywhere.
1. Never remove the focus indicator without replacing it. Give it a clear style, with a contrast of at least 3:1 against the background:
:focus-visible {
outline: 3px solid #005fcc;
outline-offset: 2px;
}
:focus:not(:focus-visible) {
outline: none;
}
html {
scroll-padding-top: 5rem;
}
scroll-padding-top prevents the targeted element from ending up under a sticky header.
2. Use native elements. <a href>, <button>, <input>, <select> and <details> can be reached and activated with the keyboard without any code. See distinguish action buttons from navigation links (opens in a new tab).
3. Let the tab order follow the DOM. Never use a tabindex greater than 0. tabindex="0" makes a non-focusable element focusable (avoid it, prefer a native element); tabindex="-1" lets a script move focus to a heading or a container. If the visual order differs from the tab order, fix the HTML rather than the CSS: see check DOM reading order (opens in a new tab).
4. Open menus with a button, not on hover:
<nav aria-label="Main menu">
<ul>
<li>
<button type="button" aria-expanded="false" aria-controls="sous-menu-produits">Products</button>
<ul id="sous-menu-produits" hidden>
<li><a href="/chaises">Chairs</a></li>
<li><a href="/tables">Tables</a></li>
</ul>
</li>
</ul>
</nav>
document.querySelectorAll('nav button[aria-controls]').forEach((bouton) => {
const sousMenu = document.getElementById(bouton.getAttribute('aria-controls'));
bouton.addEventListener('click', () => {
const ouvert = bouton.getAttribute('aria-expanded') === 'true';
bouton.setAttribute('aria-expanded', String(!ouvert));
sousMenu.hidden = ouvert;
});
bouton.parentElement.addEventListener('keydown', (event) => {
if (event.key !== 'Escape') {
return;
}
bouton.setAttribute('aria-expanded', 'false');
sousMenu.hidden = true;
bouton.focus();
});
});
5. Use <dialog> for modal dialogs. Opened with showModal(), it makes the rest of the page inert, closes with Esc, and recent browsers return focus to the triggering element when it closes:
<button type="button" id="ouvrir-guide">Size guide</button>
<dialog id="guide-tailles" aria-labelledby="titre-guide">
<h2 id="titre-guide">Size guide</h2>
<p>…</p>
<form method="dialog">
<button>Close</button>
</form>
</dialog>
<script>
document.getElementById('ouvrir-guide').addEventListener('click', () => {
document.getElementById('guide-tailles').showModal();
});
</script>
For a non-modal side panel, the inert attribute on the rest of the page prevents focus from wandering there.
Warning: consent banners, chat widgets and booking plugins are the leading source of keyboard traps, and you do not control their code. Test them first and, if the vendor does not fix them, switch tools.
WordPress
Versions WordPress 6.4 and later.
- Theme: look for
outline: noneoroutline: 0in the theme's and plugins' stylesheets, and add the:focus-visiblerule in the child theme or, for a block theme, inAppearance > Editor > Styles, ⋮ menu at the top of the panel, “Additional CSS” (Appearance > Customize > Additional CSSfor a classic theme). - Navigation block: it handles opening submenus on click and with the keyboard; in its settings, choose opening on click rather than on hover, and keep the mobile menu button.
- Skip link: recent block themes add it automatically when the template contains a
<main>group; for a classic theme, add it inheader.php. - Plugins: sliders, pop-ups, forms and consent banners need to be tested one by one. Prefer those that document their accessibility.
Shopify
Versions Online Store 2.0 themes (Horizon, Dawn), all Shopify plans, November 2026.
Recent themes, including Dawn, include a skip link, submenus built with <details> that open with the keyboard, and keyboard-managed dialogs. Problems mostly come from installed apps (reviews, loyalty, promotional pop-ups, chat) and custom sections. For your own sections, apply the rules above in assets/; for an app that traps focus, contact its developer or uninstall it (Settings > Apps and sales channels).
Wix
Versions Wix Editor and Wix Studio, November 2026.
Wix adds a skip link and manages focus on its native elements. The site's accessibility settings let you show a visible focus indicator: check that it is turned on. Test custom elements and Velo code first, as they do not benefit from these automatic features.
Squarespace
Versions Squarespace 7.1, November 2026.
Recent templates handle focus and menus with the keyboard. If you have added custom CSS, check that it does not remove the focus indicator (Website > Website Tools > Custom CSS), and test code blocks and third-party embeds.
Webflow
Versions Webflow Designer, November 2026.
In the Style panel, the “Focused (keyboard)” state corresponds to :focus-visible: style it on your link, button and field classes. The Navbar component and its dropdowns are keyboard operable; interactions triggered on hover (Mouse hover) on Div Blocks are not: replace them with click triggers on focusable elements.
Laravel
Versions Laravel 11 to 13, Livewire 3 and 4.
Put the skip link and the :focus-visible rule in the shared layout. After a form is submitted with errors, move focus to the error summary or the first field in error:
@if($errors->any())
<div id="erreurs" tabindex="-1" role="alert">
<p>{{ __('The form contains :count error(s).', ['count' => $errors->count()]) }}</p>
</div>
<script>document.getElementById('erreurs').focus();</script>
@endif
With Livewire, wire:navigate replaces the page without a reload: check where focus is after each navigation and move it back to the main heading if needed.
Next.js
Versions Next.js 15 and 16 (App Router).
Next.js announces page changes to screen readers, but does not move focus after client-side navigation: focus stays on the clicked link. Test this behavior and, if needed, move focus to the main heading of the new page:
'use client';
import { useEffect, useRef } from 'react';
import { usePathname } from 'next/navigation';
export function TitrePrincipal({ children }: { children: React.ReactNode }) {
const ref = useRef<HTMLHeadingElement>(null);
const pathname = usePathname();
useEffect(() => {
ref.current?.focus();
}, [pathname]);
return <h1 ref={ref} tabIndex={-1}>{children}</h1>;
}
For rich components (menus, tabs, drop-down lists), prefer an accessible component library that implements the keyboard patterns of the ARIA Authoring Practices rather than coding them by hand.
Nuxt
Versions Nuxt 3 and 4.
The same care as with Next.js regarding focus after navigation. Accessible UI modules and libraries handle menus, dialogs and tabs with the keyboard; for your own components, apply the five rules above.
Common mistakes
- A global
outline: nonein a CSS reset, with no replacement style. - Positive
tabindexvalues (tabindex="1","2"…): the order becomes unpredictable as soon as an element is added. - Hidden but focusable elements: a closed mobile menu or an off-screen carousel whose links remain reachable; use
hidden,display: noneorinert. - Menus that open only on hover: inaccessible with the keyboard and unreliable on touch screens.
- A modal dialog with no focus management: focus stays behind the dialog, or escapes to the page.
- Testing only with the mouse and then running an automated audit: no tool replaces the manual walkthrough; they detect missing names, not traps or illogical order.
Frequently asked questions
Is a Lighthouse audit enough to validate keyboard accessibility?
No. Lighthouse, axe or WAVE detect structural problems, such as a button with no name or a positive tabindex, but they cannot tell whether a menu opens with the keyboard, whether a dialog traps focus or whether the tab order is logical. Only a manual walkthrough with Tab, Shift + Tab, Enter, Space, the arrow keys and Esc can do that. Allow about fifteen minutes per template.
Can I remove the focus outline for aesthetic reasons?
You can replace the default focus outline, not remove it. Use the focus-visible pseudo-class: the style then only shows during keyboard navigation, not on mouse clicks, which settles most aesthetic objections. The indicator must remain clearly visible, with a contrast of at least 3:1, and must not be hidden by a sticky header or a banner.
Resources
- W3C: Understanding Success Criterion 2.1.1, Keyboardw3.org
- W3C: Understanding Success Criterion 2.1.2, No Keyboard Trapw3.org
- W3C: Understanding Success Criterion 2.4.7, Focus Visiblew3.org
- W3C: Understanding Success Criterion 2.4.11, Focus Not Obscured (Minimum)w3.org
- WebAIM: keyboard accessibilitywebaim.org
- MDN: the dialog elementdeveloper.mozilla.org
- MDN: the inert attributedeveloper.mozilla.org
- Firefox: Accessibility Inspector and tabbing orderfirefox-source-docs.mozilla.org
Updated on
Topic checklist (PDF)