Level
A
Since
WCAG 2.0
Entries
99 / 193
/ WCAG criterion

2.4.3 Focus Order

When someone moves through a page with the Tab key, focus must travel in an order that matches the meaning and layout of the page.

/ What it requires

Keyboard users move from one control to the next in sequence, and that sequence is all they have. If it jumps from the header to the footer and back, or stays outside a dialog that has just opened, the page stops making sense. Screen reader users cannot see the layout that would explain the jump. Sighted keyboard users, and people using magnification who see only a small part of the screen, lose track of where the focus went.

The criterion applies where a page can be navigated sequentially and the sequence affects meaning or operation. The order does not have to match the visual order exactly. It has to preserve meaning and operability, and there can be more than one valid order. What fails is an order that separates related controls, sends the user through the page out of sequence, or leaves focus behind the dialog or menu that has just opened on top of the page.

/ How pages fail it

  • Positive tabindex values such as tabindex="5" pull some controls to the front of the order, ahead of everything else.
  • The CSS order property, flex-direction: row-reverse or absolute positioning shows controls in one sequence while the DOM lists them in another.
  • A modal dialog opens but focus stays on the page behind it, so Tab keeps moving through content the user cannot see.
  • A dialog or menu closes and focus drops to the top of the document instead of returning to the button that opened it.
  • Content inserted by script, such as an expanded panel, is appended to the end of the DOM, far from the control that revealed it.

/ How to check it yourself

  1. Press Tab from the top of the page to the bottom and watch the focus indicator. It should move the way you would read the page, without doubling back.
  2. Press Shift+Tab back up and check that the reverse path mirrors the forward one.
  3. Open each dialog, menu and expandable panel with the keyboard. Focus should move into the new content, stay there while a modal dialog is open, and return to the opener when it closes.
  4. Search the markup for tabindex values above 0. In the DevTools console, document.querySelectorAll('[tabindex]') lists every element that sets one.
  5. Read the DOM order in the Elements panel and compare it with the visual layout.

/ How to fix it

  • Remove every positive tabindex. Use tabindex="0" to add an element to the natural order and tabindex="-1" for elements that are focused only from script.
  • Reorder the DOM so that it matches the visual sequence, instead of rearranging with the CSS order property or absolute positioning.
  • On opening a modal dialog, move focus into it. The native dialog element opened with showModal() does this, and the inert attribute keeps focus out of the rest of the page.
  • On closing a dialog or menu, call focus() on the control that opened it.
  • Insert revealed content directly after its trigger in the DOM.

/ What our scanner checks

dialog-focus-outside reports a dialog that is open when the page is checked while focus sits outside it. focus-order-jumps compares the position of each tab stop with the previous one and reports focus moving back up the page without moving right, ignoring pinned elements. Three overlapping rules report tabindex values above 0. No check can tell whether an order makes sense, and none opens a closed dialog.

/ Who fails it, in our own measurements

Measured bodies failing this criterion, most instances first
BodySectorInstancesScore
Łódźcity · PL243
Nürnbergcity · DE115
Biblioteka Narodowaculture · PL917
San Franciscocity · US728
Centers for Disease Controlhealth · US68
Cook Countygovernment · US611
Uniwersytet im. Adama Mickiewiczaeducation · PL612
Bundesministerium des Innerngovernment · DE410
Bundestaggovernment · DE410
Bydgoszczcity · PL47
Częstochowacity · PL421
Państwowa Inspekcja Pracygovernment · PL410
RWTH Aacheneducation · DE418
Warszawski Uniwersytet Medycznyeducation · PL413
Bundesregierunggovernment · DE34
Bundeszentrale für politische Bildunggovernment · DE310
Deutsche Rentenversicherunggovernment · DE35
Gorzów Wielkopolskicity · PL36
Sejm RPgovernment · PL39
Senat RPgovernment · PL324
Veterans Affairsgovernment · US333
Zamek Królewski w Warszawieculture · PL316
Zielona Góracity · PL37
Bundesagentur für Arbeitgovernment · DE216
Bundesnetzagenturgovernment · DE29
Deutsche Nationalbibliothekculture · DE223
Elblągcity · PL220
Gliwicecity · PL213
Krajowa Administracja Skarbowagovernment · PL25
Ohio State Universityeducation · US26
Politechnika Poznańskaeducation · PL24
Politechnika Śląskaeducation · PL22
Polski Instytut Sztuki Filmowejculture · PL27
Robert Koch-Instituthealth · DE210
Rybnikcity · PL27
Stuttgartcity · DE26
Teatr Wielki Opera Narodowaculture · PL23
Uniwersytet Gdańskieducation · PL218
Amtraktransport · US11
Baltimorecity · US17
Berliner Verkehrsbetriebetransport · DE121
Bremencity · DE15
Bundesministerium der Finanzengovernment · DE113
Bundesministerium für Bildung und Forschunggovernment · DE18
Bundesratgovernment · DE114
Bundesverfassungsgerichtgovernment · DE118
Department of Justicegovernment · US127
Deutsche Bahntransport · DE16
Dresdencity · DE115
Federal Aviation Administrationtransport · US114
Generalna Dyrekcja Dróg Krajowych i Autostradtransport · PL134
Główny Urząd Statystycznygovernment · PL116
Indianapoliscity · US118
Internal Revenue Servicegovernment · US120
Kancelaria Prezesa Rady Ministrówgovernment · PL136
Karlsruher Institut für Technologieeducation · DE119
Kasa Rolniczego Ubezpieczenia Społecznegogovernment · PL136
Koleje Mazowieckietransport · PL117
Komisja Nadzoru Finansowegogovernment · PL18
Lublincity · PL117
Ludwig-Maximilians-Universität Müncheneducation · DE112
Ministerstwo Cyfryzacjigovernment · PL137
Ministerstwo Edukacjigovernment · PL147
Ministerstwo Finansówgovernment · PL147
Ministerstwo Infrastrukturygovernment · PL138
Ministerstwo Klimatu i Środowiskagovernment · PL134
Ministerstwo Kulturygovernment · PL147
Ministerstwo Nauki i Szkolnictwa Wyższegogovernment · PL147
Ministerstwo Rodziny i Polityki Społecznejgovernment · PL137
Ministerstwo Rolnictwagovernment · PL132
Ministerstwo Rozwoju i Technologiigovernment · PL136
Ministerstwo Spraw Wewnętrznychgovernment · PL137
Ministerstwo Spraw Zagranicznychgovernment · PL138
Ministerstwo Sprawiedliwościgovernment · PL125
Ministerstwo Zdrowiagovernment · PL147
Muzeum Narodowe w Warszawieculture · PL111
Najwyższa Izba Kontroligovernment · PL141
Narodowy Instytut Dziedzictwaculture · PL16
Narodowy Instytut Zdrowia Publicznegohealth · PL125
Opolecity · PL18
Państwowa Komisja Wyborczagovernment · PL115
Państwowa Straż Pożarnagovernment · PL128
Politechnika Gdańskaeducation · PL122
Politechnika Wrocławskaeducation · PL117
Politechnika Łódzkaeducation · PL15
Poznańcity · PL11
Radomcity · PL12
State of Pennsylvaniagovernment · US121
State of Washingtongovernment · US18
Statistisches Bundesamtgovernment · DE19
Szczecincity · PL13
Szkoła Główna Handlowaeducation · PL112
Toruńcity · PL111
Uniwersytet Jagiellońskieducation · PL11
Uniwersytet Mikołaja Kopernikaeducation · PL17
Uniwersytet Śląskieducation · PL18
Urząd Komunikacji Elektronicznejgovernment · PL125
Urząd Zamówień Publicznychgovernment · PL147
Warszawacity · PL120

One page per body, measured by automated checks on a weekly schedule. Any body that has fixed something since the last sweep will show it at the next one, and every entity page carries a right of reply.

/ Questions about this criterion

Does focus order have to match the visual order?

Not exactly. The criterion requires an order that preserves meaning and operability, and several orders can do that. In practice a layout read from the top down, in the same sequence the DOM lists it, is what users expect, and a mismatch between the DOM and the screen is the most common reason an order stops making sense.

Is a positive tabindex a WCAG failure?

Not automatically. HTML allows a positive value, and if the resulting order still preserves meaning the page passes. The trouble is that elements with positive values come before every other control on the page, so one of them is enough to reshuffle the sequence, and the order breaks whenever the page is edited. W3C documents the resulting disorder as failure F44.

Where should focus go when a dialog opens and closes?

When a modal dialog opens, focus should move into it, to the first control, the heading or the dialog itself, and Tab should stay within it while it is open. When it closes, focus should return to the control that opened it. Leaving focus on the page behind makes keyboard users tab through content they cannot see.