src/content/docs/linter/rules/no-positive-tabindex.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="JSX and TSX" icon="seti:javascript"> ## Summary - Rule available since: `v1.0.0` - Diagnostic Category: [`lint/a11y/noPositiveTabindex`](/reference/diagnostics#diagnostic-category) - This rule is **recommended**, meaning it is enabled by default. - This rule has an [**unsafe**](/linter/#unsafe-fixes) fix. - The default severity of this rule is [**error**](/reference/diagnostics#error). - Sources: - Same as [`jsx-a11y/tabindex-no-positive`](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/tabindex-no-positive.md){
"linter": {
"rules": {
"a11y": {
"noPositiveTabindex": "error"
}
}
}
}
Prevent the usage of positive integers on tabIndex property
Avoid positive tabIndex property values to synchronize the flow of the page with keyboard tab order.
<div tabIndex={1}>foo</div>
<div tabIndex={"1"} />
React.createElement("div", { tabIndex: 1 })
<div tabIndex="0" />
React.createElement("div", { tabIndex: -1 })
{
"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.
<div tabindex="1"></div>
<div tabindex="5"></div>
<div tabindex="0"></div>
<div tabindex="-1"></div>