Avoid Using Tabindex with Positive Numbers

Avoid Using Tabindex with Positive Numbers

When positive numbers are used for tabindex, those elements become the first things users tab to in a web page. The result is that items on the page are placed out of order in terms of tab flow. While there are some special cases where it may be appropriate to change the tab order, there are generally two main issues when tabindex of positive numbers are used:

  1. Normal tab flow is broken when tabbing through a document: For example, if there are 30 links on a page, and link 29 has tabindex="1" and link 30 has tabindex="2", users will tab to these links first before tabbing to link 1 or link 2.
  2. Dynamic content can interfere with the intended tab flow: Using the same example, if JavaScript used to insert content between links 29 and 30, tabindex values will need to be assigned to each focusable element between those links in order to maintain the intended tab flow.

To make an element part of the normal tab flow, use tabindex="0".