💼 This rule is enabled in the following configs: strict-gjs, strict-gts.
Disallows positive tabindex values.
Positive tabindex values disrupt the natural tab order of the page, making keyboard navigation confusing for users. This is especially problematic for users who rely on keyboard navigation, such as those with motor disabilities.
This rule disallows positive integer values for the tabindex attribute. Only 0 (for naturally focusable elements) and -1 (for programmatically focusable elements) are allowed.
Examples of incorrect code for this rule:
<template>
<div tabindex="1">Content</div>
</template><template>
<button tabindex="2">Click</button>
</template>Examples of correct code for this rule:
<template>
<div tabindex="0">Content</div>
</template><template>
<div tabindex="-1">Content</div>
</template><template>
<button>Click</button>
</template>This rule should generally always be enabled for accessibility. However, if you have a specific use case where positive tabindex values are necessary and well-tested, you may disable it.