tabindex_no_positive

Enforce autofocus is not used on inputs. Autofocusing elements can cause usability issues for sighted and non-sighted users.

User impact: Serious

This rule supports the following configuration:

# Avoid positive `tabindex` values, change the order of elements on the page instead.
tabindex_no_positive = true

Success

<!-- Good: No tabindex attribute – rely on the order of elements -->
<!-- tabindex_no_positive = true -->
<input type="text" name="username" />
<!-- Good: Not recommended but valid -->
<!-- tabindex_no_positive = true -->
<div role="button" tabindex="0">ARIA button</div>
<!-- Good: Use -1 where appropriate, so elements can programmatically receive focus -->
<!-- tabindex_no_positive = true -->
<div tabindex="-1">I can receive focus via JS</div>

Fail

<!-- Bad: Positive values are problematic -->
<!-- tabindex_no_positive = true -->
<button type="submit" tabindex="3">Sign in</button>

Resources