accessibility glossary

Tabindex

Tabindex is an HTML attribute that controls whether and when an element receives keyboard focus via the Tab key, with tabindex=0 adding an element to the natural tab order and tabindex=-1 making it focusable only by script.

A positive tabindex value (like tabindex=5) forces an element to the front of the tab order ahead of everything else on the page, which almost always creates a confusing, unpredictable experience and is considered an anti-pattern by accessibility specialists. The two safe, commonly recommended values are 0, which adds a custom element like a div-based button into the natural document-order tab sequence, and -1, which allows an element to be focused programmatically (for example, moving focus into a newly opened dialog) without adding it to the Tab key sequence.

Native interactive elements like button and a with an href are already keyboard-focusable and do not need a tabindex at all.

Need help with Accessibility Remediation Services? See how halfAccessible can help.

Accessibility Remediation Services