Accessibility 6 min read

How to test your website using only a keyboard

Put the mouse away for ten minutes. A simple test that reveals many accessibility problems.

On this page 9 sections

Many people browse the web without a mouse. Some have motor impairments that make precise pointing difficult. Some use screen readers, which rely on keyboard commands. Others use switch devices, voice control or simply prefer the keyboard. If your website can’t be used with a keyboard, all of them are locked out of parts of it.

The good news is that keyboard testing needs no special tools or training. You can do a useful check in ten minutes with the Tab key. This guide shows you how, what to look for and how the common problems are usually fixed.

The short answer

To test keyboard accessibility:

  1. Load a page and put the mouse aside.
  2. Press Tab to move forward through links, buttons and form fields, and Shift + Tab to move back.
  3. Use Enter to follow links and press buttons, Space for buttons and checkboxes, and arrow keys inside menus, radio buttons and sliders.
  4. Press Escape to close menus and dialogs.

Check that you can reach and use everything, that you can always see where focus is, that the order makes sense, and that you never get stuck.

Why keyboard access matters

Keyboard support is a core requirement of the Web Content Accessibility Guidelines. Success criterion 2.1.1 Keyboard says all functionality must be operable through a keyboard interface. Related criteria require that focus is visible, that the focus order is logical and that users never get trapped.

It is also a good proxy for general quality. Sites that work well with a keyboard tend to use proper HTML elements, which also helps screen readers, voice control and search engines.

Keys to know

Key What it does
Tab Moves focus to the next interactive element
Shift + Tab Moves focus to the previous element
Enter Follows a link; activates a button; submits a form
Space Activates a button; ticks a checkbox; scrolls the page if nothing is focused
Arrow keys Move within radio groups, menus, tabs, sliders and select lists
Escape Closes menus, pop-ups and dialogs

On a Mac, Safari doesn’t move through links with Tab by default. Turn on “Press Tab to highlight each item on a webpage” in Safari’s settings, or test in another browser.

The test, step by step

1. Start at the top

Reload the page and press Tab once. The first focusable item is often a skip link, such as “Skip to main content”, which lets keyboard users jump past the navigation. If it is missing, keyboard users must tab through the whole menu on every page.

2. Watch the focus indicator

As you press Tab, you should always see which element is focused, usually as an outline or highlight. If focus disappears, or the indicator is too faint to see, that is a failure. WCAG 2.2 also added criterion 2.4.11 Focus Not Obscured: the focused element must not be completely hidden behind things such as sticky headers or cookie banners.

3. Check the order

Focus should move in an order that matches the visual layout: generally top to bottom, left to right in left-to-right languages. Jumping randomly around the page, or into hidden content, is confusing.

4. Use every interactive element

  • Open and close the navigation menu, including any dropdowns.
  • Operate tabs, accordions and carousels.
  • Fill in and submit a form, including error messages.
  • Open and close any dialog or pop-up, and check that focus moves into it and returns afterwards.
  • Play and pause video.

5. Make sure you never get stuck

A keyboard trap happens when focus enters a component, such as an embedded map or a pop-up, and Tab or Escape can’t get it out. That is a serious failure, because the visitor can’t continue without a mouse.

While you test, keep a simple note for each problem: the page, the element, what you pressed and what happened. For example: “Pricing page, currency switcher: Tab skips it entirely.” Notes in this form are easy for a developer to reproduce and fix, and they make it simple to retest the same steps later.

Common problems and how they are fixed

Problem Usual cause Typical fix
Clickable items can’t be reached Divs or spans used instead of links and buttons Use real <a> and <button> elements
No visible focus Outlines removed in CSS for appearance Restore or design a clear :focus-visible style
Dropdown menu only opens on hover Menu built for mouse users only Open on focus or with a button, and close with Escape
Focus lost after closing a dialog Focus not returned to the trigger Move focus back to the button that opened it
Focus hidden behind a sticky header Fixed headers covering scrolled content Add scroll padding so focused items stay visible
Strange tab order Positive tabindex values or a layout that differs from the code order Remove positive tabindex; match the code order to the visual order

Most of these are fixed by using standard HTML elements as intended. Custom-built components need more care, and patterns from the W3C’s ARIA Authoring Practices are a useful reference for developers.

Forms deserve extra attention

Forms are where keyboard problems cost the most, because they block enquiries and bookings. Check that every field can be reached and filled, that custom dropdowns and date pickers work with the keyboard, that errors are announced and focus moves to the first problem, and that the submit button can be activated with Enter. Our guide to accessible web forms covers the details.

Make it a habit

Keyboard testing is quick enough to repeat often:

  • after every design change to navigation, menus or forms;
  • before launching a new site or page template;
  • after installing plugins that add pop-ups, chat widgets or cookie banners, which commonly introduce traps.

Combine it with automated checks and, ideally, testing by disabled users. Our guide to running a website accessibility audit shows how these methods fit together.

Frequently asked questions

Do automated accessibility tools catch keyboard problems?

Only some. Tools can flag missing labels or positive tabindex values, but they can’t tell whether focus order makes sense or whether a menu can be closed. Manual keyboard testing is essential.

Is removing the focus outline ever acceptable?

Only if you replace it with another clearly visible focus style. Removing it entirely makes the site unusable for many keyboard users. The :focus-visible selector lets you show focus styles for keyboard users without affecting mouse clicks.

Does keyboard accessibility affect SEO?

Not directly, but the same practices, such as real links, buttons and clear structure, make pages easier for search engines to understand. Our guide to accessibility and SEO explains the overlap.

What to do next

Pick your homepage and your contact page, put the mouse away and try to complete an enquiry with the keyboard alone. Note every point where you lose focus, can’t reach something or get stuck.

Accessibility is built into every site we design through our website design and development service, including navigation and forms that work with a keyboard. If your current site fails this test in several places, our website redesign service can rebuild navigation and forms on accessible foundations.

Written by the PORVIX team

The people who design, build and maintain websites for growing businesses. We write about the questions that come up on real projects, in plain language, and update articles when the advice changes.

Published

How we work

Is your current site costing you enquiries?

A free, plain-language audit, by email within 2 business days.

Get a free audit
Get a free audit

Keep reading

More plain-language guides.

More on accessibility first, then other guides worth reading next.

All insights

Start here

Let’s build a website that brings in business.

Tell us about your project. You’ll hear back from a real person within one business day, with honest advice either way.

  • Free consultation
  • Fixed written quote
  • Your details stay private