tab order
The sequence in which elements receive focus when the user presses Tab (forward) or Shift+Tab (backward).
In more detail
It follows the order of elements in the DOM unless changed with tabindex. A composite widget such as a toolbar should be a single tab stop, with arrow keys moving inside it. Automated tools cannot tell whether the order makes sense.
Example
In the browser: Elements removed from the tab order with tabindex="-1" can still receive focus from script. Keeping the DOM order logical keeps the tab order logical; the tabindex attribute can adjust it but positive values usually cause confusion.Related terms
- tabindex — The HTML attribute that controls whether an element can be focused and whether it is in the tab order.
- keyboard focus — The state of being the one element on the page that receives keyboard input, usually shown with an outline.
- 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.
- composite widget — An interactive component made of several focusable items, such as a toolbar, tab list, menu or radio group, that acts as one tab stop.
- focus trap — Code that keeps keyboard focus inside a container, such as an open modal, wrapping from the last element back to the first.
Taught in
- 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
- Automated Accessibility Testing: axe-core & Testing Library — Design Systems & Component Engineering
- Pointer Events, Focus Trapping And Keyboard Accessibility — Frontend Architecture & Web Platform