tabindex
The HTML attribute that controls whether an element can be focused and whether it is in the tab order.
In more detail
tabindex="0" puts an element in the normal tab order; tabindex="-1" makes it focusable by script but skipped by Tab. Positive values force an order and should be avoided. Roving tabindex swaps 0 and -1 between items as the user moves.
Example
In JSX it is written tabIndex.Related terms
- roving tabindex — A technique where only the active item in a group has tabindex="0" and the rest have tabindex="-1", so the group is one tab stop and arrow keys move between items.
- tab order — The sequence in which elements receive focus when the user presses Tab (forward) or Shift+Tab (backward).
- focusable element — An element that can receive keyboard focus, such as a link, button, form field or anything with tabindex="0".
- keyboard focus — The single element on the page that currently receives keyboard input, such as the text box you are typing into.
- keyboard navigation — Using a page entirely with the keyboard: Tab to move between controls, Enter and Space to activate, arrow keys inside widgets, Escape to close.
Taught in
- Headless Architecture: State vs Presentation Separation — Design Systems & Component Engineering
- Focus Management: Trapping, Restoration & Focus Rings — Design Systems & Component Engineering
- Navigation & Disclosure: Dropdown Menus, Tabs & Accordions — Design Systems & Component Engineering
- Keyboard Navigation Protocols: Roving Tabindex & Virtual Focus — Design Systems & Component Engineering
- Accessible Headless Primitives: ARIA, Focus, And Keyboard — React 19 & Modern Component Architecture