Keyboard navigation test
Goal
Prove that every action available to a mouse user can be done from the keyboard, in a sensible order, with focus always visible. A good result is a list of failures tied to elements, each with the key sequence that shows it.
When to use
- The user asks if a page or flow is usable without a mouse.
- A modal, menu, tab set or custom widget was added or changed.
- For form-specific naming and error semantics, use
use_skillwithforms-accessibility. - For a full audit beyond keyboard use, use
use_skillwithaccessibility. - A custom dropdown, date picker, drag-and-drop list or tree was built from scratch.
- A release checklist asks for keyboard coverage evidence.
Steps
- Define the flows to test: the main task a visitor does, plus every overlay, menu and form on the page. Ask with
ask_userif the page is large. - Open the page with
browser_navigate. Start from the top and press Tab withbrowser_press_key, taking abrowser_screenshotorbrowser_snapshotevery few presses to see where focus is. - Record the order. It should follow the visual and reading order. Note elements that are skipped, visited twice or reached out of order.
- Check visibility: each focused element needs a clear focus indicator with enough contrast. Flag any
outline: nonewithout a replacement, found withrg. - Operate widgets: Enter or Space for buttons and links, arrow keys inside menus, tabs, radio groups and listboxes, Escape to close overlays.
- Test overlays: focus moves into a dialog on open, stays inside while open, and returns to the trigger on close. Content behind should not be reachable.
- Look for traps and dead ends: a widget that captures Tab with no exit, a hover-only menu, a skip link that is missing or broken, and page areas that scroll but cannot be focused.
- Report, and fix with
edit_fileif asked, preferring native elements (button,a,details) over repaired divs. - Check shortcuts: single-key shortcuts must be remappable or only active on focus, and must not collide with browser or screen reader keys.
- Check drag-and-drop and other pointer-heavy features for a keyboard alternative such as move up and down buttons.
Gotchas
- A positive
tabindexvalue jumps the element ahead of everything else and breaks natural order. Use 0 or -1 only. - A
divwith a click handler is not focusable and ignores Enter and Space. Making it a realbuttonfixes all three problems. - Closing a modal that removes its trigger from the DOM leaves focus on the body. Return focus to a sensible nearby control.
- Arrow-key widgets should be one tab stop, with the arrows moving inside. Making every item a tab stop makes long lists painful.
- Focus styles hidden by
overflow: hiddenon a parent look like missing focus. Check that the outline is not clipped. - Automated tools find few keyboard problems. This check needs real key presses and eyes on the focus ring.
- Focus trapped inside an iframe or embedded widget can strand a keyboard user. Test the exit path for every embed.
- Skipping to content needs a visible target. A skip link that moves nothing or points at a missing id looks right and does nothing.
- Dialogs built with the native element handle focus well. Custom ones often forget Escape and the inert background.
Output
- A list of failures: element, key sequence, expected result, actual result, suggested fix.
- A short list of what passed, so the author knows what was covered.
- Flows not tested and why, for example browser tools unable to emulate a key.
- Give each failure a numbered key sequence so a developer can replay it without guessing.
