tabindex
Also called: tabindex attribute
An HTML attribute that makes an element focusable (0), focusable only by script (-1), or changes its place in the tab order (positive values).
Definition
tabindex is a global HTML attribute defined in the HTML Living Standard. Its value controls focus:
tabindex="0": the element can be focused and is reached with Tab in source order. Use it for custom widgets that have no native focusable element.tabindex="-1": the element can be focused by script or a link target, but Tab skips it. Use it for dialog containers and skip-link targets.- A positive value, such as
tabindex="3": the element is placed in the tab order before all elements with 0 or no tabindex, ordered by value.
Why it matters
Positive values are the risky ones. They pull a few elements ahead of everything else, so focus jumps around the page and breaks 2.4.3 Focus Order. On the other side, a clickable div without tabindex="0" cannot be reached at all, failing 2.1.1 Keyboard.
How to test or meet it
- Prefer native elements (
button,a href,input), which are focusable without tabindex. - Use
0and-1only, and only where needed. - Don't add
tabindex="0"to plain text or headings; it adds useless stops for keyboard users.
axe-core flags positive tabindex values as a best practice. Tab through the page to confirm the order follows the layout.
WCAG criteria
- 2.4.3 Focus Order (Level A)
- 2.1.1 Keyboard (Level A)
Related terms
Sources
By the Perceivly team · Published . This explains a term; it is not legal advice.