Skip to content

noNoninteractiveTabindex (HTML)

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

Require a negative integer tabindex on non-interactive elements.

Pressing Tab moves keyboard focus through interactive controls. Adding a non-interactive element to that order creates a keyboard stop with no expected action and can confuse users. Assistive technologies can navigate structural content without adding it to the tab order.

For a static value, only a negative integer is accepted. Zero, positive integers, empty values, and other text are reported. Dynamic values are not evaluated.

<div tabindex="0"></div>
code-block.html:1:6 lint/a11y/noNoninteractiveTabindex  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ The HTML element div is non-interactive. Do not use tabindex.

> 1 │ <div tabindex="0"></div>
│ ^^^^^^^^^^^^
2 │

ℹ Adding non-interactive elements to the keyboard navigation flow can confuse users.

ℹ Unsafe fix: Remove the tabindex attribute.

1 │ <div·tabindex="0"></div>
│ ------------
<div role="article" tabindex="0"></div>
code-block.html:1:21 lint/a11y/noNoninteractiveTabindex  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ The HTML element div is non-interactive. Do not use tabindex.

> 1 │ <div role="article" tabindex="0"></div>
│ ^^^^^^^^^^^^
2 │

ℹ Adding non-interactive elements to the keyboard navigation flow can confuse users.

ℹ Unsafe fix: Remove the tabindex attribute.

1 │ <div·role="article"·tabindex="0"></div>
│ ------------
<article tabindex="0"></article>
code-block.html:1:10 lint/a11y/noNoninteractiveTabindex  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

✖ The HTML element article is non-interactive. Do not use tabindex.

> 1 │ <article tabindex="0"></article>
│ ^^^^^^^^^^^^
2 │

ℹ Adding non-interactive elements to the keyboard navigation flow can confuse users.

ℹ Unsafe fix: Remove the tabindex attribute.

1 │ <article·tabindex="0"></article>
│ ------------
<div></div>
<button tabindex="0"></button>
<article tabindex="-1"></article>