Need help? Email shivaji@ananyoo.com Contact

Accessibility

Keyboard Accessibility Testing: 8 Practical Checks Anyone Can Do

Keyboard accessibility testing in 15 minutes: 8 practical checks anyone can do without a mouse, what a pass and a fail look like, and the code fixes for common problems.

Keyboard accessibility testing: a card reading Keyboard Accessibility Testing, 8 checks, no mouse, next to a keyboard and an unplugged mouse on a wooden desk.

Keyboard accessibility testing is the fastest accessibility check you can do yourself, and it finds real problems. You need no software, no training and no budget. Put the mouse to one side, press Tab, and try to use your own website. Within a few minutes you will know whether people who cannot use a mouse can actually buy, book, sign up or contact you.

I have been building and testing accessible websites since 2003, and keyboard problems turn up in almost every audit our team does. You can see some of that work in our web accessibility case studies.

This guide gives you 8 practical checks, the keys to use, what a pass and a fail look like, and the simple code fixes for the problems you are most likely to find.

On this pageJump to any part of this page10 sections

Who depends on keyboard accessibility?

Far more people than most site owners think. Keyboard access is not only about people who use a physical keyboard instead of a mouse:

  • Blind and low vision users who use a screen reader move through pages with the keyboard, not a mouse.
  • People with motor disabilities, tremors, arthritis or repetitive strain injury often find a mouse painful or impossible.
  • Switch users and voice control users rely on software that sends keyboard commands behind the scenes.
  • People with a temporary injury, such as a broken arm or a wrist in a brace.
  • Power users who simply find the keyboard faster for forms and long tasks.

If something on your site cannot be reached or used with a keyboard, all of these people are locked out of it. That is why WCAG makes it a Level A requirement under 2.1.1 Keyboard: every function must work through a keyboard interface, with no exceptions for "it works fine with a mouse".

Before you start keyboard accessibility testing

You need about 15 minutes and the following setup:

  • Unplug the mouse or push it out of reach, and do not touch the trackpad. It is very easy to cheat without noticing.
  • Use Chrome, Edge or Firefox on Windows for your first test. On a Mac, turn on Keyboard navigation in System Settings, and in Safari also turn on "Press Tab to highlight each item on a webpage" in the Advanced settings, otherwise Tab skips links.
  • Pick your most important pages: the home page, a product or service page, the contact form, and checkout or sign-up if you have them.
  • Keep a notepad open and write down every place you get stuck, lose track of where you are, or need to reach for the mouse.

These are the keys you will use:

  • Tab moves forward to the next link, button or field. Shift + Tab moves back.
  • Enter follows a link or presses a button.
  • Space presses a button, ticks a checkbox and scrolls the page.
  • Arrow keys move inside menus, radio buttons, tabs, sliders and lists.
  • Esc closes pop-ups, menus and dialogs.

8 practical checks for keyboard accessibility testing

Work through these in order. The first four take a couple of minutes on any page; the last four test the interactive parts where most real failures hide.

1. Can you reach everything with Tab?

Press Tab from the very top of the page and keep going until you reach the footer. Every link, button, form field and interactive control should receive focus at some point. Watch for things you can click with a mouse but never land on with Tab: icon buttons, "Read more" cards, social icons, chat widgets and custom controls built from div or span elements.

The usual cause is a fake button. The fix is to use the real element, which is focusable and works with Enter and Space for free:

<!-- Fails: not focusable, no keyboard support -->
<div class="btn" onclick="openCart()">Cart</div>

<!-- Passes -->
<button type="button" onclick="openCart()">Cart</button>

2. Can you always see where you are?

As you tab, there must be a clear outline or highlight on the focused item at every step. If focus disappears, a keyboard user is lost. This is WCAG 2.4.7 Focus Visible, and many themes still remove the browser outline with outline: none because a designer did not like it. Also check that focus is never hidden behind a sticky header, cookie banner or chat button, which WCAG 2.2 added as 2.4.11 Focus Not Obscured.

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #1a4fd6;
  outline-offset: 2px;
}
html {
  /* keep focused items clear of a sticky header */
  scroll-padding-top: 90px;
}

Our guide to WCAG 2.2 explained covers the new focus rules in more detail.

3. Does the focus order make sense?

Focus should move in the same order as you read the page: top to bottom, left to right, header, then main content, then footer. If focus suddenly jumps from the header to the footer and back, or skips half of a form, the order is broken (WCAG 2.4.3 Focus Order). The two usual causes are CSS that visually rearranges content, and positive tabindex values such as tabindex="3". Remove positive tabindex values and keep the HTML in a sensible reading order.

On the very first Tab press, a "Skip to main content" link should appear. Press Enter on it, then press Tab again: focus should land inside the main content, not back at the top menu. Without it, keyboard users must tab through the whole header and menu on every single page (WCAG 2.4.1 Bypass Blocks).

Keyboard accessibility testing in practice: after the first Tab press, a Skip to main content link with a yellow focus outline appears at the top left of a website on a laptop.
<a class="skip-link" href="#main">Skip to main content</a>
...
<main id="main" tabindex="-1">...</main>

.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 1rem; top: 1rem; z-index: 1000; }

5. Do menus and dropdowns work?

Tab to the main menu. Can you open each dropdown with Enter or Space, move through its items with Tab or the arrow keys, and close it with Esc? Menus that only open on mouse hover are one of the most common failures we find, and they hide whole sections of a site from keyboard users. The button that opens a submenu should also tell screen readers whether it is open with aria-expanded.

A website dropdown menu opened with the keyboard: under Services, the Remediation item has a thick blue focus outline while a finger rests on the arrow keys.

A simple, reliable pattern is a real button next to each top-level link. The button opens and closes the submenu, and a few lines of script keep aria-expanded in step with what is on screen:

<li>
  <a href="/services/">Services</a>
  <button type="button" aria-expanded="false" aria-controls="sub-services">
    <span class="visually-hidden">Services submenu</span>
  </button>
  <ul id="sub-services" hidden>
    <li><a href="/audit/">Accessibility Audit</a></li>
    <li><a href="/remediation/">Remediation</a></li>
  </ul>
</li>

When the button is pressed, set aria-expanded="true" and remove hidden from the list. When Esc is pressed inside the submenu, close it and move focus back to the button. This keeps the top-level link working as a normal link while giving keyboard and screen reader users a clear way to open the submenu.

Check the mobile menu too. Make the browser window narrow, then tab to the menu button, open it, move through it and close it with Esc. Focus should not wander behind the open menu into the page underneath.

When a dialog opens, focus should move into it. While it is open, Tab should stay inside it. Esc or a visible Close button should close it, and focus should then return to the button that opened it. Two failures are very common here: focus stays behind the pop-up on the page, so the user cannot reach it at all, or the dialog has no keyboard way out, which is a keyboard trap (WCAG 2.1.2 No Keyboard Trap).

A woman wearing a wrist brace uses only the keyboard to close a Subscribe to our newsletter pop-up; the Close button has a blue focus outline.

The native HTML dialog element handles most of this for you when it is opened with showModal(): focus moves inside, the page behind is made inert, and Esc closes it.

<button type="button" id="open">Subscribe</button>
<dialog id="news" aria-labelledby="news-title">
  <h2 id="news-title">Subscribe to our newsletter</h2>
  ...
  <button type="button" id="close">Close</button>
</dialog>

<script>
const dlg = document.getElementById('news');
document.getElementById('open').onclick = () => dlg.showModal();
document.getElementById('close').onclick = () => dlg.close();
</script>

7. Do forms and custom controls work?

Complete your most important form using only the keyboard. Radio buttons should move with the arrow keys, checkboxes should tick with Space, and dropdowns should open and change with the keyboard. Then try the custom parts: date pickers, sliders, star ratings, accordions, tabs, carousels and file uploads. These are where keyboard support most often breaks. Submit the form with errors and check that you can get to each error and fix it. Our guide to accessible web forms covers the form side in depth.

8. Are there any traps or surprises?

Finally, watch for anything unexpected. Focus should never get stuck in an embedded video, map, chat widget or third-party iframe. Moving focus onto a field should not submit a form, open a new window or change the page (WCAG 3.2.1 On Focus). If your site has single-key shortcuts, such as pressing "s" to search, users must be able to turn them off or change them, because they can be triggered by speech input by mistake (WCAG 2.1.4 Character Key Shortcuts).

How to record what you find

Keyboard accessibility testing is only useful if the results lead to fixes. For each problem, write down five things so a developer can find and fix it without guessing:

  • The page, as a full web address.
  • The element, described the way a visitor sees it, for example "the Services menu in the header" or "the Close button on the newsletter pop-up".
  • What you pressed, for example "Tab four times from the top, then Enter".
  • What happened, for example "nothing opened" or "focus disappeared behind the cookie banner".
  • The WCAG criterion, if you know it, such as 2.1.1 or 2.4.7.

A short screen recording helps a lot. Most problems you find will repeat across many pages, because they come from the theme or a shared component. Fix them once in the template and they disappear everywhere, which is why keyboard accessibility testing on a few key templates gives you so much value for so little time.

What a pass and a fail look like

After 15 minutes you should be able to answer yes to each of these:

  • I could reach every link, button and field on the page with Tab.
  • I could always see where focus was, and it never disappeared behind a header or banner.
  • Focus moved in a logical reading order.
  • The skip link appeared and took me to the main content.
  • Every menu, dropdown and dialog opened, worked and closed with the keyboard.
  • I completed the main form or checkout without touching the mouse.
  • I never got stuck anywhere and nothing changed unexpectedly.

If you answered no to any of these, you have found a real barrier. Note the page, the element and what happened, so a developer can fix it quickly.

Common keyboard accessibility mistakes we find in audits

  • Removing focus outlines for design reasons, with nothing to replace them.
  • Clickable divs and spans used instead of real links and buttons.
  • Hover-only menus that never open with Enter, Space or the arrow keys.
  • Image carousels and sliders whose arrows and dots cannot be reached, or that keep moving while the user tries to read.
  • Cookie banners and newsletter pop-ups that take over the screen but cannot be closed with the keyboard.
  • Third-party widgets such as chat tools and booking engines that trap focus.
  • Overlay toolbars sold as a quick fix. They cannot repair keyboard support in your own code. See accessibility overlays: pros and cons explained.

Keyboard testing is the first step, not the last

A clean keyboard test is a very good sign, but it is not a full audit. The next step is to repeat the same journeys with a screen reader, which tells you whether each control is named and announced correctly. Our screen reader testing guide shows how to do that with NVDA, JAWS, VoiceOver and TalkBack. For the full set of checks, use our WCAG checklist.

It also helps to repeat keyboard accessibility testing after every major change: a new theme, a new plugin, a redesigned menu or a new pop-up. Most keyboard barriers are added by accident during updates, not at launch. A 15 minute check before each release catches them long before a customer or a lawyer does.

Keyboard problems are also among the first things named in ADA demand letters, because they are easy for a tester to show on video. If you have already received one, read what to do after an ADA demand letter.

Keyboard-friendly WordPress themes and plugins

If you use WordPress, much of this work can be done for you. Our Ariade accessible theme ships with a working skip link, strong visible focus outlines, keyboard-operable menus with aria-expanded, and focus that is never hidden behind its sticky header. Our free WordPress accessibility plugins follow the same rules, including the Ananyoo Accessible Carousel, which has keyboard controls, a pause button and no auto-play surprises.

How Ananyoo can help

I am Shivaji Mitra, a DHS Trusted Tester, and our audit team is IAAP certified. We test every key journey on your site with the keyboard and with screen readers, then fix the problems in your theme, menus, forms and widgets so they stay fixed.

Start with a website accessibility audit, then accessibility remediation for the issues we find. Send your website address through our contact page, and you will get a written reply within one working day.

Frequently asked questions

What is keyboard accessibility testing?

Keyboard accessibility testing means using a website with only the keyboard, mainly Tab, Shift + Tab, Enter, Space, the arrow keys and Esc, to check that every link, button, form and control can be reached, used and left without a mouse.

Which WCAG criteria cover keyboard access?

The main ones are 2.1.1 Keyboard, 2.1.2 No Keyboard Trap, 2.1.4 Character Key Shortcuts, 2.4.1 Bypass Blocks, 2.4.3 Focus Order, 2.4.7 Focus Visible, 2.4.11 Focus Not Obscured and 3.2.1 On Focus.

Can automated tools test keyboard accessibility?

Only a small part of it. Tools can spot some missing focus styles or positive tabindex values, but they cannot tell whether a menu opens, a dialog traps focus or the order makes sense. That needs a person with a keyboard.

Is keyboard accessibility testing required by law?

The law does not name a testing method, but WCAG 2.1 AA is the standard behind ADA Title II, the European Accessibility Act and most settlements, and every keyboard criterion above is part of it. Regular keyboard accessibility testing is the simplest way to show you are checking for it.

How long does a keyboard test take?

About 15 minutes for a small site's key pages. A larger site with many templates, forms and widgets takes longer, but the same 8 checks apply to every page.

Does my site need to work with the keyboard on mobile too?

Yes. Many people pair a Bluetooth keyboard or a switch device with a phone or tablet, so menus and dialogs must work the same way at small screen sizes.

Shivaji Mitra Avatar

About the author

Leave a Reply

Your email address will not be published. Required fields are marked *


Accessibility settings

Saved on this device. Change them any time.

Read our accessibility statement