Where does Tab go next?
Focus Order Trace: paste HTML and see every Tab stop in order, what each one announces, and what's left out.
Up to 4 KB. Your markup is parsed, never rendered. Scripts and resources in it do not run or load. Only Copy link puts HTML in the URL; links are not encrypted.
7 Tab stops; 1 jumps ahead because of a positive tabindex
Computed from the markup alone. Browsers can add stops this can’t see, such as scrollable areas, and Safari skips links by default unless the keyboard setting is on.
Tab order
Stop 1: link “Docs”
<a href="/docs" tabindex="2">tabindex="2" moves it ahead of 2 elements before it in the source.
- Positive tabindex
Stop 2: link “Skip to content”
<a href="#main">Stop 3: link “Home”
<a href="/">Stop 4: generic, no accessible name
<div tabindex="0">- No role
Stop 5: searchbox “Search the docs”
<input type="search" aria-label="Search the docs">Stop 6: button, no accessible name
<button>- No name
Stop 7: link, no accessible name
<a href="/offer">- Inside aria-hidden
Not in the Tab order
<button tabindex="-1">tabindex is negative: focusable by script, never by Tab.
Checks and fixes
A positive tabindex moves these ahead of everything else on the page.
<a href="/docs" tabindex="2">
Use tabindex="0" (or none, on a native control) and put the element where it belongs in the source.
<button>Search</button>These are Tab stops with no interactive role, so a screen reader announces nothing useful.
<div tabindex="0">
Use a native control, or give the element a role and the keyboard behaviour that role promises.
<button type="button">Open menu</button>These Tab stops have no accessible name.
<button>
Give each one a visible label or text content that says what it does.
<button><svg aria-hidden="true">…</svg> Close</button>These can take focus inside aria-hidden="true", so a screen reader user lands on nothing.
<a href="/offer">
Remove aria-hidden, or make the content truly unavailable with hidden or inert.
<div inert> <a href="/offers">Offers</a> </div>tabindex="-1" takes these controls out of the Tab order.
WCAG 2.1.1 Confirm this on the rendered page.
<button tabindex="-1">
Keep it only where a script moves focus here, such as a roving tabindex in a toolbar or tabs; otherwise remove it.
<a href="/pricing">Pricing</a>
Explainer
Tab follows the source, unless you tell it otherwise
Keyboard users move through a page with Tab and Shift+Tab. Each element they land on is a stop in the sequential focus navigation order. That order should keep the meaning and the way the page works, so what people reach next matches what they see next. See WCAG 2.4.3: Focus Order.
What gets a stop
Links with an href, buttons, form fields, iframe, media with
controls, the first summary of a details element, editable
content and any element with a tabindex of 0 or more. Disabled controls, hidden or
inert content, the inside of a closed details and a closed
dialog get none. A radio group gets one stop, on the checked radio or on the first one
when none is checked, and the arrow keys move inside it. See the HTML standard on
sequential focus navigation
.
Why a positive tabindex hurts
Elements with a tabindex above 0 come first, lowest number first, before everything else
on the page. One tabindex="1" can send a keyboard user past the skip link and the
navigation. Use tabindex="0", or no tabindex on a native control, and move the element in
the source instead. tabindex="-1" takes an element out of the Tab order but leaves it
focusable by script, which suits roving focus in tabs or toolbars. See
the tabindex attribute
.
A stop has to say what it is
A screen reader announces each stop by its role and name. A div with
tabindex="0" has neither, so prefer a native control. Content inside
aria-hidden="true" is hidden from screen readers but still takes focus, so a user can
land on something that is never announced; use inert or hidden for content
that should be out of reach. See
WCAG 4.1.2: Name, Role, Value
.
What pasted HTML cannot tell us
This tool reads attributes, not the rendered page. It recognizes hidden, inert
and inline hiding styles, but not stylesheet rules. CSS that reorders content (flex order
, reversed directions, grid placement, absolute positioning) can make the visual order differ from the
Tab order; the checks flag inline cases for you to confirm. Browsers can also add stops of their own,
such as scrollable areas, and Safari only tabs to links when its keyboard setting allows. Always test
the final page with a keyboard. See
WCAG 1.3.2: Meaningful Sequence
.