Focus Order
Focus has to move in an order that preserves meaning. Usually that means source order — and when something opens on top, like a dialog, focus goes into it and comes back out where it started.
- Principle
- Operable
- Guideline
- 2.4
- Level
- A
- In WCAG since
- 2.0
- Number
- 2.4.3
Broken, then fixed
The same interface twice: first with the mistake, then with the smallest change that fixes it.
A dialog opens and focus stays behind it.
The dialog is visually in front and focus is still on the page behind it. A keyboard user tabs through content they cannot see, operating an interface hidden under an overlay.
Focus follows the dialog in and back out.
On open, focus moves into the dialog. While open, the rest is inert. On close, it returns to the control that opened it, so the reader’s place is not lost.
How to test
Check your own interface against 2.4.3, one step at a time.
- Click in the address bar and press Tab through the whole page. Note the order in which each control receives focus.
- Compare that order with the order in which the page reads, top to bottom and in reading direction. Check that no jump changes what the content means or how it is used, such as a form field reached after its submit button.
- Search the page source for tabindex values greater than 0. Check that any order they force still makes sense.
- Open each dialog, menu and disclosure. Check that focus moves into it when it opens and goes back to the control that opened it when it closes.
- Where content appears after an action, such as an error message or a new set of fields, check that the next Tab press reaches it, not the page footer.
Common questions
Must the focus order match the visual order exactly?
No. 2.4.3 asks that the order keeps the meaning and the operation of the page intact. Several orders can do that, and only one of them has to be provided.
Does a positive tabindex fail 2.4.3?
Only when the order it creates loses meaning or stops the page working. In practice it usually does, because it pulls those elements ahead of everything else on the page. Change the source order instead.
Where should focus go when a dialog closes?
Back to the control that opened it, or to the next sensible place if that control has gone. Focus that drops to the top of the page makes the person find their place again.
Try it yourself
A lab is a small working piece of interface that you change yourself. Read its steps, use the controls under it, and watch the verdict line at the bottom: it says whether the criterion passes or fails as you go. Reset puts it back.
Try it: break the focus order
How to use this lab
- Goal. Keep the order Tab moves through a form the same as the order it is seen in.
- The controls. The options under “Source order: the markup” change the order of the form’s parts in the HTML, which the layout ignores. The options under “Positive tabindex” give tabindex="1" to Postcode or to Send. The numbers on the mock, and the “Tab visits” line, show where focus goes.
- Try this. The lab starts in order. Pick Column by column, or Send button first, and watch the numbers. Then set the source order back to Row by row and give tabindex="1" to Postcode.
- What it means. When “Tab visits” matches “Seen on screen”, 2.4.3 passes. When it doesn’t, 2.4.3 fails: keyboard users and people using a screen magnifier jump about the form and lose their place. The verdict line under the lab says which.
Seen on screen
Name → Email → Phone → Postcode → SendTab visits
In the markup
<input name="name"><input name="email"><input name="phone"><input name="postcode"><button>Send</button>
2.4.3 passes
Also in guideline 2.4
Criteria in the same guideline often fail together.
- 2.4.1, OperableLevel A
Bypass Blocks
Fails when: Every menu link stands between the reader and the article.
- 2.4.2, OperableLevel A
Page Titled
Fails when: The same title on every page.
- 2.4.4, OperableLevel A
Link Purpose (In Context)
Fails when: Three “read more” links, with their titles in a separate column.
- 2.4.5, OperableLevel AA
Multiple Ways
Fails when: A deep hierarchy and nothing else.
- 2.4.6, OperableLevel AA
Headings and Labels
Fails when: Headings that describe nothing.
- 2.4.7, OperableLevel AA
Focus Visible
Fails when: The outline was removed and nothing replaced it.