Skip to content

noPositiveTabindex (HTML)

biome.json
{
"linter": {
"rules": {
"a11y": {
"noPositiveTabindex": "error"
}
}
}
}

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.

WCAG 2.4.3

<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>