This feature is well established and works across many devices and browser versions. It’s been available across browsers since October 2018.
The tabIndex property of the HTMLElement interface represents the tab order of the current element.
Tab order is as follows:
tabIndex. Elements that have identical tabIndex values should be navigated in the order they appear. Navigation proceeds from the lowest tabIndex to the highest tabIndex.tabIndex attribute or support it and assign tabIndex to 0, in the order they appear.Elements that are disabled do not participate in the tabbing order.
Values don't need to be sequential, nor must they begin with any particular value. They may even be negative, though each browser trims very large values.
An integer.
const b1 = document.getElementById("button1");
b1.tabIndex = 1;
| Specification |
|---|
| HTML> # dom-tabindex> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
tabIndex |
1 | 1812–18Returns incorrect value for elements without an explicit tabindex attribute. See issue 4365703 for details. |
1 | ≤12.1 | 3.1 | 18 | 4 | ≤12.1 | 2 | 1.0 | 4.4 | 2 |
tabindex global attribute.
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/tabIndex