UK web hosting · 24/7 live chat Black Friday + Cyber Monday: hosting + free domain £19.99 Open a ticket Client login

Guide

Keyboard navigation and focus: how to test and fix your website

By Limitless Hosting · 5 min read · Updated 18 November 2026

A website works with a keyboard if you can reach and use every link, button and field with the Tab, Enter, Space and arrow keys, and always see where you are. Many people cannot use a mouse, including people with motor disabilities and screen reader users. Testing takes five minutes, and the fixes are mostly about showing focus and fixing menus.

See the plans

The basics

Why the keyboard matters

Not everyone points and clicks. People who have tremors, limited hand movement or repetitive strain, people who use switches or voice control, and blind people using screen readers all move around a page with the keyboard or something that behaves like one. If a menu opens only when you hover over it, or a button cannot be reached with Tab, those visitors are stuck.

Keyboard access is also a fast way to find many other problems. A page that works well with the keyboard is usually built from proper links, buttons and headings, which also helps screen readers and search engines.

WCAG has several rules about it. Everything must be operable from the keyboard, you must never trap focus in a part of the page, and the element with focus must be visible.

Test it

A five-minute keyboard test

Click the page, then press Tab

Focus should move to the first link or button. Keep pressing Tab and watch where it goes.

Check you can always see focus

A clear outline or highlight should show which element you are on. If it vanishes, that is a failure.

Use the menus

Open the main menu and sub-menus with Tab, Enter and the arrow keys. Make sure you can reach every item and close the menu again with Escape.

Press Enter and Space

Links should work with Enter. Buttons should work with Enter and Space. Fill in and submit a form.

Look for traps

If you tab into a pop-up or video and cannot get out, you have found a keyboard trap. Fix it first.

Fixes

Common keyboard problems and how to fix them

ProblemWhat the visitor seesFix
Focus outline removed with CSSNo idea where they are on the pageRestore a clear outline, or design a visible focus style
Menu opens only on hoverKeyboard users cannot open itMake it open on focus or with a button press
A clickable box made from a divTab skips itUse a real link or button element
A pop-up that traps focusCannot get back to the pageAdd a close button and return focus when it closes
No way to skip the navigationMust tab through every link on every pageAdd a "Skip to content" link at the top
A sticky header covering focused itemsThe focused link is hiddenAdd scroll padding so focus is never hidden

Worked example

A worked example: fixing a hover menu

A very common keyboard failure is a drop-down menu that opens only when the mouse hovers over the top item. A visitor using the keyboard can tab to the top item, but the sub-menu never opens, so the pages inside it are unreachable.

The fix has three parts. First, make the top item a real button or link that responds to Enter and Space as well as hover. Second, have the sub-menu open when the item receives focus or when the button is pressed, and keep it open while focus is inside it. Third, make Escape close the menu and return focus to the top item.

If your site uses a theme or page builder, check its settings first. Many modern themes have an option for keyboard-friendly menus, and updating the theme often fixes the problem. If not, a developer can usually fix it with a small amount of code. After the change, repeat the five-minute test to confirm every item can be reached.

Common mistakes

Mistakes that break keyboard access

The most common mistake is removing the focus outline because a designer finds it ugly. A line of CSS that hides it takes away the only signal keyboard users have. If you dislike the default, design your own, with a thick, high-contrast outline or a clear background change.

Another is using the wrong elements. A clickable box made from a plain div looks like a button but is invisible to the keyboard unless extra code is added. A real link or button element works with Tab, Enter and Space with no extra work, and screen readers announce it correctly.

A third is changing the visual order of the page with CSS so that it no longer matches the order in the code. Tab follows the order in the code, so focus jumps around unpredictably. Keep the two in step.

Finally, watch out for embedded content such as maps, videos and booking widgets from other companies. Test each one with the keyboard. If a widget traps focus, ask the supplier for a fix, or offer another way to do the same task, such as a phone number or an email link.

Before you publish

A keyboard checklist

  • You can reach every link, button and field with Tab
  • The focused item is always clearly visible
  • Focus order follows the visual order of the page
  • Menus open with the keyboard and close with Escape
  • There is a skip link to the main content
  • Pop-ups can be closed with the keyboard and return focus
  • You never get stuck in a widget or embedded map
  • Buttons work with Enter and Space, links with Enter
  • Sticky headers do not hide the focused item
  • Forms can be completed and sent without a mouse

Beyond the basics

Testing on a phone and with assistive tools

Keyboard access is also the foundation for other tools. Switch devices and voice control software use the same focus order as the keyboard, so fixing it helps them too. On a phone, test that tap targets are large enough and not packed too closely together, which WCAG 2.2 now asks for.

Once the keyboard test passes, try a screen reader for a few minutes on your home page and contact page. Notice whether headings, links and buttons are announced sensibly. Small fixes to labels and heading order often make a large difference.

A fast, secure home for an accessible site

UK servers in London, free SSL and live chat open 24/7 on every plan, from 84p a month (£10.03 billed yearly).

See the plans

FAQ

Common questions

How do I test keyboard access?

Put the mouse aside and use Tab, Shift+Tab, Enter, Space, the arrow keys and Escape to move through and use the page.

What is a keyboard trap?

A part of a page you can tab into but cannot leave with the keyboard, often a pop-up or embedded widget.

Is it fine to hide the focus outline?

No. Visible focus is required, so replace the default outline with a clear style if you dislike it.

What is a skip link?

A link at the top of the page that jumps to the main content, so keyboard users can avoid tabbing through the navigation.

Do hover menus fail?

If they cannot be opened with the keyboard, yes. Make them open on focus or with a button.

Host your accessible site in the UK

Free SSL and live chat on every plan, with a 15-day money-back guarantee.

See the plans .co.uk and .uk domains £9.99

From 84p a month, billed yearly
15-day money back
Get started