We'd like to set Google Analytics cookies to learn how people use the Knowledge Base, so we can improve it. We set them only if you accept.

Skip to main content
Digital Accessibility Knowledge Base

tab-order

Web validation

Focusable elements must receive focus in an order that preserves meaning and operability.

Keyboard users move between the controls on a page by pressing the Tab key. By default, focus moves in the order of the elements in the DOM. When the order in which controls receive focus does not match their visual order on screen, keyboard users may become disoriented and struggle to navigate the interface correctly. This issue is usually caused by one of the following:

  • Elements with positive tabindex values that don't match the visual order on the screen.
  • Elements or their parent elements using absolute positioning in a way that disrupts the natural tab sequence.
  • Elements or their parent elements using CSS that visually reorders them, such as the flexbox order property, flex-direction: row-reverse or column-reverse, or grid placement, leading to a visual order different from the code order.

To fix the issue:

  • Remove positive tabindex values. The values 0 and -1 are valid.
  • Avoid using CSS to visually rearrange controls, or elements that contain controls.
  • Ensure elements are positioned according to the natural DOM flow.

Note: This validation is about the order in which keyboard focus moves between interactive elements. The order in which assistive technologies read the content is covered by the related screen-reading-order validation, and positive tabindex values on their own are covered by the tabindex validation.

Pass Patterns

Controls in DOM order

The fields and button have no tabindex, so focus follows the DOM order, which matches the visual order.

HTML
<form>
    <label for="first-name">First name</label>
    <input type="text" id="first-name" />


    <label for="last-name">Last name</label>
    <input type="text" id="last-name" />


    <button type="submit">Continue</button>
</form>

Flex layout that keeps the DOM order

The buttons are laid out with flexbox, but they are not reordered, so the focus order matches what users see.

HTML
<div style="display: flex; gap: 1rem;">
    <button>Back</button>
    <button>Next</button>
</div>

Fail Patterns

Positive tabindex values

The positive tabindex values move focus from the first field straight to the button, skipping the second field.

HTML
<form>
    <label for="first-name">First name</label>
    <input type="text" id="first-name" tabindex="1" />


    <label for="last-name">Last name</label>
    <input type="text" id="last-name" />


    <button type="submit" tabindex="2">Continue</button>
</form>

Control moved with absolute positioning

The "Save" button is shown at the top of the form, but it is last in the DOM, so keyboard users reach it only after all the fields.

HTML
<form style="position: relative; padding-top: 3rem;">
    <label for="title">Title</label>
    <input type="text" id="title" />


    <label for="description">Description</label>
    <textarea id="description"></textarea>


    <button type="submit" style="position: absolute; top: 0; right: 0;">Save</button>
</form>

Controls reordered with flexbox order

"Back" is shown first on screen, but "Next" comes first in the DOM, so the Tab key moves right to left.

HTML
<div style="display: flex; gap: 1rem;">
    <button style="order: 2;">Next</button>
    <button style="order: 1;">Back</button>
</div>

WCAG techniques

Sufficient techniques

Failure techniques

Try It Yourself

Using a keyboard

  1. Load the page and place focus at the top of the page.
  2. Press Tab repeatedly to move through the interactive elements, and Shift+Tab to move back.
  3. Compare the order in which elements receive focus with their visual order on screen.

Expected results: Focus moves through the interactive elements in a logical order that matches the visual layout.

Actual results: Focus jumps around the page, skips elements, or reaches them in an order that does not match the visual layout.

Inspecting the browser dev-tools

  1. Search the page's elements for tabindex attributes with a value greater than 0.
  2. For the elements that receive focus out of order, check their CSS and their parents' CSS for position: absolute or fixed, order, reversed flex-direction, or grid placement.
  3. In Chrome's dev tools, you can also open the Accessibility panel and turn on Show source order to compare the DOM order with the layout.

Expected results: No element has a positive tabindex, and the DOM order of the interactive elements matches their visual order.

Actual results: Positive tabindex values or CSS reordering make the focus order differ from the visual order.

FAQ

How does this issue relate to 2.4.3 Focus Order?

SC 2.4.3 requires that when a page can be navigated sequentially, focusable elements receive focus in an order that preserves meaning and operability. When positive tabindex values or CSS reordering make the focus order differ from the visual and logical order, keyboard users may reach controls out of context, so the criterion is not met.

Why is this issue marked as Serious?

When focus moves in an unexpected order, keyboard users may lose their place, miss fields, or activate controls before completing the steps that come before them. This makes forms and multi-step processes difficult to complete, so it is rated serious.

Does the focus order have to match the visual order exactly?

Not always. SC 2.4.3 requires an order that preserves meaning and operability, so small differences are acceptable as long as the order is still logical. Problems arise when the focus order contradicts the way users read and use the page.

Standards and Regulations

StandardSuccess CriterionReference
WCAG 2.22.4.3 Focus Order (A)If a web page can be navigated sequentially and the navigation sequences affect meaning or operation, focusable components receive focus in an order that preserves meaning and operability.
EN 301 5499.2.4.3 Focus OrderSame as the WCAG text.
508 Trusted Tester2.4.3-focus-order-meaning, 4.FThe focus order preserves the meaning and operability of the web page.

Personas impacted by this issue