Auditing Keyboard Accessibility: Tab Order, Focus and Custom Widgets
How the browser builds tab order, why positive tabindex and clickable divs fail keyboard users, and how to audit focus styles and widget patterns in HTML.

Try this on your own site: put the mouse away and use only Tab, Shift+Tab, Enter, Space and the arrow keys. Can you reach every control? Can you see where you are? Does focus move in the order you read? Many sites fail at least one of these, and the cause is usually visible in the markup. This guide explains how keyboard focus works and how to audit it with the Keyboard Navigation and Tab Order Auditor.
How the browser builds the tab order
Elements are focusable by default when they are links with href, buttons, form fields other than hidden inputs, iframes, summary elements, media with controls, or contenteditable. Any element can join with tabindex. The order is:
- Elements with a positive tabindex, in ascending number order.
- Everything else with tabindex 0 or natively focusable, in source order.
Elements with tabindex="-1" can receive focus from script but are skipped by Tab. Disabled controls, controls inside a disabled fieldset, hidden content and inert subtrees are skipped too. A group of radio buttons with the same name is one stop; arrow keys move inside it.
The common failures
- Positive tabindex. It pulls one element to the front and breaks the reading order (WCAG 2.4.3).
- Clickable divs and spans. An onclick on a div does nothing for the keyboard (WCAG 2.1.1). A role="button" without tabindex is worse: screen readers announce a button that cannot be reached.
- Links without href used as buttons are not focusable.
- Removed focus outlines. A rule like
*:focus { outline: none }without a replacement leaves keyboard users blind (WCAG 2.4.7). - Focusable content inside aria-hidden. Focus lands on something that screen readers do not announce.
- Composite widgets with too many stops. A tab list, menu or listbox should be one stop with arrow keys inside, using a roving tabindex.
- Keyboard traps. A script that captures Tab without an Escape route can lock focus inside a widget (WCAG 2.1.2).
Running the audit
Paste HTML into the auditor. The Tab order view lists every stop with its number, element, accessible name and role, and badges for tabindex values and notes. Below it, focusable elements that are left out are listed with the reason: disabled, hidden, inert, tabindex -1 or a radio group member.
The issues panel collects everything found: positive tabindex, click handlers on non-focusable elements (including Vue, Angular and Alpine syntax), widget roles without tabindex, outline removal without a :focus-visible replacement, a missing skip link on long pages, tab lists and menus with several stops, dialogs without aria-modal, and scripts that may trap Tab.
Stepping through
The Step through tab turns the list into a simulation. Press the Tab and Shift+Tab buttons, or the left and right arrow keys, and a virtual focus moves through the stops. For each one you see what a screen reader would roughly announce, any problems with that element, a warning when the next stop jumps back up the page, and the source with the element highlighted. This is a quick way to explain an order problem to a colleague or in a bug report.
The Try it tab renders your markup in a sandbox with scripts disabled. Click inside and press the real Tab key to see the browser's own focus order and focus ring.
A worked example
On the sample product page, the Contact link has tabindex 1, so keyboard focus starts there instead of at the logo. A product card is a div with onclick and the favourite icon is a span with role=button, so neither can be reached. Three tabs are three separate stops. A Quick view button is focusable inside aria-hidden. The style block removes every outline. The fixes are short: remove tabindex 1, make the card a link and the icon a button with a name, use a roving tabindex in the tab list, take aria-hidden off the visible button, and replace outline none with a clear :focus-visible style.
What still needs manual testing
The auditor reads markup and inline styles. It cannot run your event handlers, see elements hidden by external stylesheets, or prove that a custom widget responds to the arrow keys. Use its findings as a map of where to test, then test with a real keyboard and a screen reader before you call a page accessible.



