- Success Criterion 3.2.1
- Conformance level A
Autofocus Chain That Jumps Focus From One Field to Another
3.2.1 — On Focus
Scenario
Setting
A hospital's patient portal appointment scheduler
What’s wrong
Autofocus chains: focusing field A programmatically jumping focus to field B.
Example
<input id="appt-month" maxlength="2" onfocus="highlightStep(1)"
oninput="document.getElementById('appt-day').focus()">
<input id="appt-day" maxlength="2"> Why it matters
As soon as the patient finishes typing the month, focus is yanked to the day field, so anyone reviewing or correcting the month with a screen reader loses their place mid-entry.
How to test
Tab to field A and stop: if focus programmatically jumps to field B without any user action, it fails.
How to fix
Prefer a single native date input, or if using segmented fields, let the browser's normal tab order move focus rather than scripting jumps on input.
<input id="appt-month" maxlength="2">
<input id="appt-day" maxlength="2"> Outcome
A patient typing an appointment date keeps control of focus and can review each field before moving on.
Who is affected
Screen reader and switch-access users entering an appointment date get their focus forcibly relocated before they've confirmed what they typed.
Learn more
- Understanding Understanding document (opens in a new tab)
Related scenarios
- Element That Loses Focus the Instant It’s Reached
- Tabbing Into a Field That Opens a Modal Automatically
- Tabbing to a Menu Item That Auto-Navigates to Its Page
- Selecting an Option That Submits the Form Automatically
- Keyboard Focus Triggering an Unexpected Scroll Jump
- Tabbing Into a Field That Opens a Chat Widget