ChaosQA · Guides

Keyboard navigation test cases for web forms

Updated November 24, 2026

Put the mouse aside and fill in the whole form with the keyboard. Some people use a form only this way, and some bugs exist only on this path, such as a check that runs on a mouse click and not on Enter. Testing tools that set field values from a script never press a key, so they do not reach these bugs at all.

Before you start

On a Mac, Safari moves focus with Tab only between fields by default and skips buttons and links. Turn on "Press Tab to highlight each item" in Safari's Advanced settings, or use Option+Tab, or test in another browser. Otherwise every button that Tab skips ends up in your report.

Tab order

Click in the address bar, then press Tab until focus reaches the first field. Keep pressing Tab and write down each stop until focus leaves the form. Then go back with Shift+Tab.

A positive tabindex in the HTML, such as tabindex="3", puts that element ahead of everything with the default order, wherever it sits on the page. Search the page source for it when the order looks wrong.

Can you see where focus is?

At every stop, you should be able to tell which control has focus without moving the mouse. The usual cause of a missing ring is CSS such as outline: none with nothing put in its place. Check the submit button and the checkboxes in particular: designers often restyle them, and the restyled version may have no focus state. WCAG 2.4.7 asks for a visible focus indicator.

Keys for each control

Native HTML controls come with these keys. A control rebuilt from div elements has none of them until someone writes the handlers, so a custom dropdown or date picker needs the same checks as a native one.

ControlKeysExpected
Text fieldTyping, Backspace, Home, EndText changes as typed, the caret moves
CheckboxSpaceToggles
Radio groupTab, then arrow keysTab enters the group once, at the selected option; arrows move and select
SelectArrow keys; Alt+Down to open the listThe option changes; on some systems the arrows change it with the list closed
ButtonEnter and SpaceSame result as a click
LinkEnterOpens it; Space scrolls the page instead
DialogEscapeCloses it, and focus returns to the control that opened it

A select whose arrow keys change the value with the list closed fires a change for every option you pass. A form that reloads part of the page or sends a request on each change does it once per arrow press. Watch the Network tab while you move through a long list.

Three ways to submit

Fill the form in correctly, then break one rule, for example leave a required box unticked. Submit it three ways:

  1. Click the submit button.
  2. Press Enter in a text field.
  3. Tab to the submit button and press Space.

All three should end the same way: the same error, and no request to the server. In a plain form the browser makes them the same: Enter in a text field fires a click on the submit button. They split when the page handles keys itself. A script may listen for Enter and submit by a route of its own, with its own copy of the checks, or a click handler may look at mouse details that a key press does not have (event.detail is 0 for a click made with Enter or Space). Write down which way you used in the report, since a developer who clicks will not see the bug.

Two details of Enter are worth a test of their own. In a textarea, Enter should add a line, not submit. And a form with no submit button and more than one text field does nothing on Enter, as the HTML standard specifies. A button with type="button", or one built from a div, does not count as a submit button. Then press Enter twice quickly in a text field and count the requests. The double submit guide covers what to look for.

Typing versus filling

A field gets its value in different ways, and each fires different browser events:

How the value arrivesKey eventsInput event
Typed, key by keyYes, for every characterYes
PastedOnly for the paste shortcut, not for the charactersYes, once
Browser autofillNoYes
Set by a scriptNoNo

Code that formats or limits a value can listen to any of these. A handler on key presses that upper-cases or cuts the text runs for typed input and not for pasted input; a check on the input event runs for both but not for a value set by a script. So enter the same value twice, typed and pasted, and compare what the field holds afterwards and what the request carries. Browser automation tools differ in the same way: Playwright's fill() sets the value and fires one input event, while pressSequentially() presses each key.

This is also why AI testing agents, which mostly fill fields from scripts, miss keyboard bugs. The guide on what agents miss has the numbers from a set of runs.

Focus after an error

Submit with an error and look at where focus is now. The helpful place is the first field with an error, or a summary of errors at the top that links to each field. Focus left on the submit button, with the message out of view above it, makes a keyboard user press Shift+Tab back through the form to find the problem.

Worse is focus on nothing. If the page redraws the form after the error, the focused element may be removed, and the next Tab starts again from the top of the page.

Then correct the field and press Tab out of it. The message should go away without another submit, the same as with the mouse.

A short set

With five minutes for a form: one full pass with Tab and Shift+Tab, noting the order and any stop without a visible ring; the three ways to submit with one rule broken; one field typed and then pasted with the same value; and where focus lands after an error.

Try it on a live form. The JoinBox practice has a sign-up form and a login form with written rules. Do one full pass with the keyboard only and one with the mouse, and compare what each finds.
Open the practice form

More guides: sign-up and login forms · silent failures and stale screens · all guides