Lab 4

Keyboard Only

Keyboard accessibility testing practice

Finish a short task with the mouse switched off. The point is not to explain keyboard access. It is to feel it.

Before you start

Inside the dashed box below, clicks and taps do nothing. That is on purpose. For a lot of people it is every day: a mouse that hurts to use, a trackpad that died, a switch, a screen reader, voice control that moves focus for them. They get through the web with the keys you are about to use.

You will need five of them. Tab moves forward, Shift+Tab moves back, Enter activates buttons and links, Space ticks boxes, and the arrow keys move inside menus. There is also a decoy in the box. See if you can find it.

Two hands on a keyboard with a mouse unplugged and pushed aside; the screen shows three boxes with a focus ring around the middle one.

The lab

Four steps. Your Tab presses are counted and your focus path is listed as you go. If you reach for the mouse, the box says no.

What you just learned

  • Tab order is DOM order. Focus moved through the controls in the sequence they appear in the HTML, not in the sequence they appear on screen. When those differ, keyboard users get lost. See Reading order is not visual order.
  • A div is not a button. The grey "Continue" box has a click handler and looks like a control. It never received focus because a div is not focusable. Use button, and it works for everyone by default.
  • Enter and Space are not the same. Enter activates buttons and links. Space ticks checkboxes and also presses buttons. Enter on a checkbox does nothing, and a form that submits on Enter inside a checkbox has reinvented a trap.
  • Menus use the arrow keys. A menu button opens with Enter, Space, or an arrow key; the arrows move between items; Enter chooses; Escape closes and puts focus back on the button. That is the pattern screen readers and voice control expect.
  • You could see where you were. Every control in the box has the site's two-tone focus ring. Try the same task on a page with outline: none and the count stops mattering, because you cannot tell where focus is. The Focus Lab is about that.

The quick test for your own pages

Unplug the mouse. Load the page. Try to do the one thing the page is for. Every place you get stuck is a bug, and the skip link is usually the first one.

Embed this lab

Host the Keyboard Only lab on your own page with one element and one script. It runs entirely in the visitor's browser, sends nothing back, and adds a small credit link.

<div data-a11y-world-lab="keyboard"></div>
<script src="https://a11y.world/embed.js" async></script>
  • Hover is a state most people do not have

    Touch, keyboard, switch, and voice never hover. A menu, tooltip, or button that appears only on hover does not exist for them.

  • Tab order is a promise the DOM makes

    The Tab key follows the HTML, not the layout. CSS cannot change that order, a positive tabindex hijacks it, and aria-hidden does not remove a stop. One real walk found 162 stops where a list of the markup said 64. Here is why, and how to check.

  • The sticky header that eats your focus

    Shift+Tab back up a form and the field you land on slides under the sticky header. The browser scrolled just far enough, and just far enough is behind the bar. WCAG 2.2 calls it focus not obscured. One CSS property fixes it.

  • Where focus goes when a dialog opens

    A dialog owes a keyboard user three things. Put focus inside it on open. Keep Tab inside while it is open. Give focus back to the opener on close. Miss any one and the reader is lost behind the dialog or dropped at the top of the page.

  • Skip links people actually find

    A skip link that is first in the tab order, visible the moment it has focus, and labeled for where it goes. Most skip links fail at least one of those.

  • The focus ring is the interface

    For anyone who moves through a page without a mouse, the focus ring is the cursor. Here is what a great one looks like and why most of them fail.

Found a page that fails this test?

Tell us which one and what got in the way. The best examples become field notes.

Send an example