tabindex_no_positive
Prevents using positive
tabindex
values, which are very easy to misuse with problematic consequences for keyboard users.User impact: Serious
This rule supports the following configuration:
- TOML
- Shell
# Avoid positive `tabindex` values, change the order of elements on the page instead.tabindex_no_positive = true
# Avoid positive `tabindex` values, change the order of elements on the page instead.curlylint --rule 'tabindex_no_positive: true' .
#
Success- TOML
- Shell
<!-- 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>
<!-- Good: No tabindex attribute โ rely on the order of elements --><!-- curlylint --rule 'tabindex_no_positive: true' . --><input type="text" name="username" /><!-- Good: Not recommended but valid --><!-- curlylint --rule 'tabindex_no_positive: true' . --><div role="button" tabindex="0">ARIA button</div><!-- Good: Use -1 where appropriate, so elements can programmatically receive focus --><!-- curlylint --rule 'tabindex_no_positive: true' . --><div tabindex="-1">I can receive focus via JS</div>
#
Fail- TOML
- Shell
<!-- Bad: Positive values are problematic --><!-- tabindex_no_positive = true --><button type="submit" tabindex="3">Sign in</button>
<!-- Bad: Positive values are problematic --><!-- curlylint --rule 'tabindex_no_positive: true' . --><button type="submit" tabindex="3">Sign in</button>