noPositiveTabindex (HTML)
Summary
Section titled “Summary”- Rule available since:
v2.4.0 - Diagnostic Category:
lint/a11y/noPositiveTabindex - This rule is recommended, meaning it is enabled by default.
- This rule has an unsafe fix.
- The default severity of this rule is error.
- Sources:
- Inspired from
jsx-a11y/tabindex-no-positive - Same as
@html-eslint/no-positive-tabindex
- Inspired from
How to configure
Section titled “How to configure”{ "linter": { "rules": { "a11y": { "noPositiveTabindex": "error" } } }}Description
Section titled “Description”Prevent the usage of positive integers on tabindex attribute.
Avoid positive tabindex attribute values to synchronize the flow of the page with keyboard tab order.
Accessibility guidelines
Section titled “Accessibility guidelines”Examples
Section titled “Examples”Invalid
Section titled “Invalid”<div tabindex="1"></div>code-block.html:1:15 lint/a11y/noPositiveTabindex FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Avoid positive values for the tabindex attribute.
> 1 │ <div tabindex="1"></div>
│ ^^^
2 │
ℹ Elements with a positive tabindex override natural page content order. This causes elements without a positive tab index to come last when navigating using a keyboard.
ℹ Use only 0 and -1 as tabindex values. Avoid using tabindex values greater than 0 and CSS properties that can change the order of focusable HTML elements.
ℹ Unsafe fix: Remove the tabindex attribute.
1 │ <div·tabindex="1"></div>
│ ------------
<div tabindex="5"></div>code-block.html:1:15 lint/a11y/noPositiveTabindex FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Avoid positive values for the tabindex attribute.
> 1 │ <div tabindex="5"></div>
│ ^^^
2 │
ℹ Elements with a positive tabindex override natural page content order. This causes elements without a positive tab index to come last when navigating using a keyboard.
ℹ Use only 0 and -1 as tabindex values. Avoid using tabindex values greater than 0 and CSS properties that can change the order of focusable HTML elements.
ℹ Unsafe fix: Remove the tabindex attribute.
1 │ <div·tabindex="5"></div>
│ ------------
<div tabindex="0"></div><div tabindex="-1"></div>Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.