Skip to content
This repository was archived by the owner on Jul 15, 2023. It is now read-only.

Latest commit

 

History

History
40 lines (29 loc) · 886 Bytes

react-a11y-tabindex-no-positive-Rule.md

File metadata and controls

40 lines (29 loc) · 886 Bytes

react-a11y-tabindex-no-positive

Enforce tabindex value is not greater than zero. Avoid positive tabindex attribute values to synchronize the flow of the page with keyboard tab order.

References

Rule options

This rule takes no arguments.

Examples

Bad

// Never really sure what goes after A.
<span tabindex='1'>A</span>
<span tabindex='5'>B</span>
<span tabindex='3'>C</span>
<span tabindex='2'>D</span>

// An empty tabindex is not allowed.
<span tabindex>E</span>
<span tabindex=''>F</span>
<span tabindex={}>G</span>
<span tabindex={ '' }>H</span>

Good

// Using correct tabindex value either 0 or -1.
<span tabindex='0'>A</span>
<span tabindex='-1'>B</span>
<span tabindex={ 0 }>C</span>
<span tabindex={ '0' }>D</span>