Skip to content
PeekWellThe Casebook
Join now

Keyboard accessibility: test your site with Tab, then fix what breaks

Cheeky, the mint-green founder in a yellow polo, stands on a glowing key-shaped stone with a hammer in one mitten and a coffee cup in the other, surrounded by blank keys, an arrow signpost, a spirit level, a coil of rope and a lantern floating in the air.

Put your mouse in a drawer for five minutes and try to buy something from your own site. Keyboard accessibility means that everything a visitor can do on your site with a mouse, they can also do with Tab, Shift+Tab, Enter, Space, Escape and the arrow keys, while always seeing where they are on the page and never getting stuck. To test it, press Tab from the top of your home page and try to reject cookies, open the menu, add something to the basket and check out. If the focus disappears, gets stuck or jumps around, that’s the first thing to fix.

Most people who try this are surprised by where it goes wrong, and I’ll come back to that in the build order near the end, once you’ve seen it yourself. Below are the test, the HTML and CSS that fix the usual failures, and a straight answer to what comes next: is this the law where you sell, and which WCAG does it mean? If you only came for the code, skip to the focus indicator section.

What keyboard accessibility means

More people browse without a mouse than you’d guess. W3C’s guidance on the keyboard criterion lists people who are blind, people with low vision who lose track of a pointer, and people with tremor: Some people with hand tremors find using a mouse very difficult and therefore usually use a keyboard. Add screen reader users, who move by keyboard, and anyone nursing a broken wrist.

In WCAG terms, keyboard navigation accessibility comes down to six success criteria in WCAG 2.2, the current W3C Recommendation:

Criterion Level What it asks, in plain words
2.1.1 Keyboard A Everything works from the keyboard
2.1.2 No Keyboard Trap A If Tab can get you into something, the keyboard can get you out
2.4.1 Bypass Blocks A A way to skip the header and menu that repeat on every page
2.4.3 Focus Order A Focus moves in an order that makes sense
2.4.7 Focus Visible AA You can see which element has focus
2.4.11 Focus Not Obscured (Minimum) AA Nothing you built hides the focused element completely (new in 2.2)

Checking your own site takes five minutes.

The five-minute keyboard test

Open your home page fresh in a desktop browser, leave the mouse alone, and go through these steps:

  1. Click once in the address bar, then press Tab. The first thing to light up should be a “Skip to content” link.
  2. Tab on to the cookie banner. Can you reach Reject and the settings without tabbing through the whole page first?
  3. Make a choice, then move into the main menu. Do dropdowns open with Enter or Space, or only when a mouse hovers?
  4. Wait for any popup or newsletter box. Does focus move into it, does Escape close it, and where does focus land afterwards?
  5. Find the chat bubble, if you have one. Can you open it and close it again?
  6. Fill in a form, then add a product to the basket and check out as far as payment.
  7. Along the way, try Shift+Tab to go back and Space on buttons and checkboxes.

At each stop, ask four things. Can I see where focus is? Does the tab order follow what I see on screen? Can I get out? Did anything open just because it got focus?

Write down every no. Zoom, screen readers and contrast are in the accessibility audit guide, images in the alt text examples, and the rest in the ADA compliance checklist.

Keyboard navigation keys: which key does what

The later steps need more than Tab, because each kind of control answers to its own keys. W3C’s ARIA Authoring Practices Guide writes them down pattern by pattern. These are the ones you’ll meet on a business site, with what a keyboard accessible page does when you press them:

Control Keys What should happen
Link Enter The link opens
Button Enter or Space The button does its job
Checkbox Space The box ticks or unticks
Radio group Tab, then arrow keys Tab enters and leaves the group; the arrows move to the next or previous option and check it
Dropdown list Up and Down Arrow, Enter, Escape The arrows move through the options, Enter takes the one in focus, Escape closes the list
Dialog or popup Tab, Shift+Tab, Escape Focus moves inside when it opens and Tab stays inside; Escape closes it, and focus normally goes back to what opened it
Menu button Enter or Space, Up and Down Arrow, Escape The menu opens with focus on its first item; the arrows move through the items; Escape closes it and returns focus to the button
Tabs Tab, Left and Right Arrow Tab lands on the active tab, the arrows move between tabs, and Tab again goes on to the panel
Accordion Enter or Space The panel under the focused header opens or closes
Slider Arrow keys, Home, End The arrows change the value one step; Home and End jump to the lowest and highest value

The table is the short version. Each pattern page lists every key, the optional ones included, and that’s where to send a developer who is building one of these by hand. If a key on your site does nothing, or does something you didn’t expect, add it to your notes. Often, though, the first no arrives long before any of these keys, on the very first press of Tab.

Focus indicator: make it visible and keep it

If you pressed Tab in step 1 and couldn’t tell where you were, you’ve met the most common failure. Browsers draw a focus indicator by default, usually a ring. Then a CSS reset or theme adds :focus { outline: none; } because the ring looked untidy after a mouse click, and it’s gone for everyone. W3C’s page on 2.4.7 puts the cost plainly: Without a focus indicator, sighted keyboard users cannot operate the page.

You don’t have to choose between tidy and usable. The :focus-visible selector matches when the browser decides focus should be shown, and MDN describes it as a way to give a different focus state for mouse and keyboard users. It has worked across browsers since March 2022. Delete the rule that hides the outline and add one that draws a clear one:

/* Delete rules like this from your theme or reset */
:focus { outline: none; }

/* Then draw a clear ring for keyboard focus */
:focus-visible {
  outline: 3px solid #1a4fd6;
  outline-offset: 2px;
}

Choose a colour that stands out on every background. WCAG’s 1.4.11 asks for 3:1 contrast for the cues that show a control’s state, and W3C counts focus indicators among them.

WCAG 2.2 added a newer problem: a ring that’s drawn but hidden. A sticky header, a pinned cookie bar or a chat button can sit right on top of the link you just tabbed to. W3C’s explanation of 2.4.11 names the usual suspect: A notification implemented as sticky content, such as a cookie banner, will fail this success criterion if it entirely obscures a component receiving focus.

W3C’s technique C43 fixes it with scroll-padding, which MDN says lets you exclude regions covered by fixed toolbars when the browser scrolls something into view. Set it to the height of whatever is sticky:

html {
  scroll-padding-top: 5rem;    /* height of your sticky header */
  scroll-padding-bottom: 6rem; /* height of a pinned cookie bar */
}

A visible ring fixes half of step 1. The other half was the long walk through the header.

That long walk is what a skip link saves. W3C’s technique G1 describes it in one line: The first interactive item in the web page is a link to the beginning of the main content. It’s the usual way to meet 2.4.1, and you’ll also see it called a skip navigation link or a “skip to content” link.

<body>
  <a class="skip-link" href="#main">Skip to content</a>
  <header>…logo, menu, search…</header>
  <main id="main">…</main>
</body>

Most sites hide it until it gets focus:

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
}
.skip-link:focus {
  top: 1rem;
}

W3C prefers a link that’s visible all the time, so if your design has room for a small “Skip to content”, leave it showing.

Jumping focus has another cause. Tab order follows the HTML, not the screen, so CSS that reorders things visually (a flex order, a grid placement) sends focus skipping between columns, and a positive tabindex such as tabindex="3" pulls one element out of line. MDN’s advice is short: You are recommended to only use 0 and -1 as tabindex values.

Then there’s the clickable div, which isn’t in the tab order and ignores Enter and Space. A real button gets both from the browser, as W3C’s button pattern expects.

<!-- Before: mouse only -->
<div class="menu-toggle" onclick="openMenu()">Menu</div>

<!-- After: reachable with Tab, works with Enter and Space -->
<button type="button" class="menu-toggle"
        aria-expanded="false" aria-controls="site-menu">Menu</button>

Use a button for actions, an a href for anything that goes somewhere, and tabindex="0" only on custom widgets with their own key handling. That leaves the worst stop on the test, the place where you got stuck.

Keyboard trap: banners, modals, menus and chat widgets

A keyboard trap is a spot Tab can take you into and no key gets you out of. On a business site, most of them come from four parts.

The banner is the first thing a visitor meets, so focus should reach it within a press or two, with Reject reachable without tabbing through the page behind it. After a choice, focus should land somewhere sensible, like the top of the page, not vanish with the banner. Whether Reject is as easy as Accept is also a consent question (EU-03), and the cookie banner examples show layouts that work.

Popups and modals

A popup that holds focus isn’t a trap as long as it lets go. W3C’s page on 2.1.2 even lists a modal dialog that keeps focus inside as an example, because it can be closed. The browser’s own dialog element, opened with showModal(), does most of the work:

<dialog id="newsletter">
  <h2>Get the newsletter</h2>
  <form method="dialog">
    <label>Email <input type="email" name="email"></label>
    <button value="subscribe">Subscribe</button>
    <button value="cancel" autofocus>No thanks</button>
  </form>
</dialog>

<script>
  document.getElementById('newsletter').showModal();
</script>

According to MDN, focus moves inside, to the element marked autofocus if there is one, and Modal dialogs can also be closed by pressing the Esc key. While it’s open, the rest of the page becomes inert, and when it closes, the HTML standard sends focus back to whatever had it before. For a slide-out menu or another overlay that isn’t a dialog, put the inert attribute on the page behind it while it’s open.

Dropdowns that open only on hover can’t be opened from a keyboard, and a hamburger icon built as a div can’t be reached at all. W3C’s disclosure navigation example shows the pattern that works: each dropdown has a real button with aria-expanded, and Escape closes an open dropdown and puts focus back on its button.

Chat and review widgets

Third-party widgets are hardest, because the code isn’t yours. Some grab focus as they load; some open a window Escape won’t close. Look in its settings for a way to stop it opening on its own; if that fails, ask the vendor in writing whether Escape closes it and returns focus. I can’t tell you what they’ll answer. A plain link to your contact page works for everyone meanwhile.

Authorities test this way too. In 2022 the US Justice Department settled with CVS Pharmacy over its vaccine registration portal, having determined that people navigating without a mouse would need to press the Tab key hundreds, or potentially thousands, of times to move past one control. CVS didn’t admit wrongdoing and agreed to bring its vaccine content to WCAG 2.1 AA. A settlement isn’t a court finding, but the reviewers clearly pressed Tab and counted, which brings us to the legal question.

What the law asks: WCAG 2.1 or 2.2, by jurisdiction

The rules point at WCAG without imposing it on every private site, and the version depends on who you are. This is a summary, not legal advice; if a letter has arrived, talk to a lawyer before you reply.

European Union

The European Accessibility Act has applied since 28 June 2025 to services in its scope, e-commerce among them, and the European standard EN 301 549 is the usual way to show you meet it. Its new version, V4.1.1, was published on 2 September 2026 with its web clauses aligned to WCAG 2.2. Its foreword says the presumption of conformity applies Once the present document is cited in the Official Journal of the European Union under that Directive, and I couldn’t find that citation when I checked on 23 November 2026. Ireland’s National Disability Authority expects it on 16 December 2026. Until then V3.2.1, built on WCAG 2.1, stays in force, and that’s the version the Commission harmonised in August 2021 to support the Web Accessibility Directive, the one for public sector websites and apps. Microenterprises providing services are exempt. More in EU-10, and the statement the Act asks for is in EU-17.

United Kingdom

No UK law writes WCAG into the rules for private websites. The Equality Act 2010 gives service providers a duty to make reasonable adjustments, which means you take such steps as it is reasonable to have to take to avoid the disadvantage (section 20). Public sector bodies get a number: GOV.UK says their sites meet the legal requirements if they meet WCAG 2.2 AA and publish an accessibility statement. As I read it, that’s the clearest yardstick a private business can borrow. More in UK-12.

United States

Title III of the ADA covers businesses open to the public, with no technical web rule. The Justice Department’s web guidance of 18 March 2022 gives businesses flexibility, names WCAG as helpful guidance, and describes this exact barrier: people who can’t use a mouse or trackpad will not be able to access web content if they cannot navigate a website using a keyboard. State and local governments do have a rule: 28 CFR 35.200 sets WCAG 2.1 AA, and an interim final rule of 20 April 2026 moved its dates to 26 April 2027 for the larger ones and 26 April 2028 for the rest. More in the lawsuits post and US-06.

And WCAG 3.0?

It isn’t close. W3C’s introduction page, updated on 16 November 2026, says WCAG 3 is not expected to be a completed W3C standard for a few more years.

Keyboard accessibility fixes in build order, and a prompt

Which version, then? I’d build to WCAG 2.2 AA. It’s what the new European standard and the UK public sector name, and it builds on the 2.1 that the US rule uses, adding 2.4.11 on top.

Remember the surprise from the top? Look at your notes. The stops where you got stuck were probably things added later, like the banner, the popup, the chat bubble or one line in a CSS reset, not the pages you wrote. That’s good news, because most fixes swap something custom for a button, a link or a dialog, which come with keyboard support built in. So work in this order:

  1. Restore focus styles: delete outline: none, add :focus-visible.
  2. Add the skip link and a main element with an id.
  3. Swap clickable divs for buttons and links.
  4. Fix the cookie banner’s keyboard path, including where focus goes after a choice.
  5. Make menus open with Enter and Space and close with Escape.
  6. Move popups and modals to dialog with showModal().
  7. Configure, or replace, widgets that trap focus or open on their own.
  8. Run the five-minute test again.

An assistant can help with steps 1 to 6. It only sees the markup you paste, so widgets loaded by script still need the live test. Copy this:

Here is the HTML and CSS of my website's header, cookie banner, main menu and one modal or popup:

[paste the code here]

Review it for keyboard accessibility against WCAG 2.2 level AA. Look for:
- focus outlines removed (outline: none or outline: 0) with no visible replacement
- clickable elements that are not real <button> or <a href> elements
- any tabindex greater than 0
- a missing "skip to content" link or a missing <main> element
- menus or dropdowns that only open on hover
- anything that can trap keyboard focus or can't be closed with Escape
- sticky elements that could cover the focused element

Give me the corrected code, then a list of every change you made and the WCAG success criterion each change addresses. If something depends on JavaScript I haven't pasted, say so instead of guessing.

Check your own site with a phone

Now repeat it on a phone: pair a Bluetooth keyboard, or narrow a desktop browser to phone width.

  1. Open your home page in a private window, so no earlier cookie choice is remembered.
  2. Press Tab once. Is the first stop a skip link, with a ring you can see?
  3. Tab to the cookie banner, choose Reject, and note where focus lands.
  4. Open the menu and any popup from the keyboard, and close each with Escape.
  5. Go to checkout or your main form. Does anything sticky hide a field when it gets focus?
  6. Note every stop where you couldn’t see focus, get out or go on.

Peeky reads the public pages of your site for barriers a keyboard or screen reader user runs into: keyboard traps, unlabelled fields, missing alt text, weak contrast and a missing page language. The checks are EU-10 for the European Accessibility Act, UK-12 for reasonable adjustments under the Equality Act, and US-06 for the ADA.

Then take the mouse back out of the drawer. If you made it to checkout without it, so can your customers.

Questions people ask

Is WCAG 2.1 or 2.2 required?

It depends on the rule. The US Title II rule for public entities names WCAG 2.1 AA. UK public sector bodies are told to meet WCAG 2.2 AA. In the EU the version in force, harmonised for the public sector's Web Accessibility Directive, is built on 2.1, and the new EN 301 549 V4.1.1, built on 2.2, hadn't been cited, as far as I could find, when I checked on 23 November 2026. Building to 2.2 AA covers all three.

Is WCAG legally required?

Not by name for most private sites. The EU's Accessibility Act sets requirements and EN 301 549, which builds on WCAG, is how you show you meet them. The UK's Equality Act asks for reasonable adjustments and names no standard. In the US, the DOJ says businesses have flexibility in how they comply and points to WCAG as helpful guidance. The details are in the law section above.

What makes a website keyboard accessible?

A site is keyboard accessible when every link, button, form field, menu and popup can be reached and used without a mouse, focus is always visible, the tab order follows the page, and nothing traps you. In WCAG 2.2 that's six success criteria, starting with 2.1.1 Keyboard. Each control should also answer the keys in W3C's ARIA Authoring Practices Guide, such as Enter for a link and Space for a checkbox.

What is a skip link and do I need one?

A skip link is the first link on the page, usually hidden until you press Tab, that jumps past the header and menu to the main content. WCAG 2.2 asks for a way to bypass blocks repeated on every page, and W3C's technique G1 makes the skip link the first interactive item. Headings and landmarks help screen reader users too, but a skip link is the simplest fix for keyboard users.

Why can't I see where I am when I press Tab?

Usually because a theme or CSS reset contains outline: none and nothing replaced it. The browser draws a focus ring by default; that rule erases it. Put a clear outline back with the :focus-visible selector, which shows it for keyboard users. W3C puts it simply: without a focus indicator, sighted keyboard users cannot operate the page.

Has WCAG 3.0 been released?

No. W3C's introduction page, updated on 16 November 2026, calls WCAG 3 an incomplete draft that will change, and says it is not expected to be a completed W3C standard for a few more years. WCAG 2.2 is the current standard, and the laws and standards in this guide all point to version 2.1 or 2.2.

Filed with