Rule
Positive tabindex
Positive tabindex values disrupt the natural focus order.
- Rule
positive-tabindex- Type
- Best practice, not a WCAG requirement. It runs when Best practices is switched on.
- Severity
- Serious
What it checks
The rule fails any element whose tabindex is greater than zero. A value of 0 or -1 passes.
Positive values pull elements to the front of the tab order, ahead of everything in normal reading order. Keyboard and screen reader users then jump around the page in a sequence that matches neither the layout nor the source.
Example
Fails
<a href="/">Home</a>
<a href="/donate" tabindex="1">Donate</a>
Passes
<div id="results" tabindex="-1">
<h2>Results</h2>
</div>
The engine is tested against both examples.
How to fix it
Use tabindex="0", or remove the attribute, and put the element where it belongs in the source order.
Check your own pages
This rule runs in every pour audit: the browser extension, the bookmarklet, the command line and the editor. Get pour, free.