Skip to content

Latest commit

 

History

History
59 lines (41 loc) · 1.66 KB

File metadata and controls

59 lines (41 loc) · 1.66 KB

ember/template-no-positive-tabindex

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

Rule Details

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

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>

When Not To Use It

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.

References