Receiving focus does not cause unexpected navigation
Why it matters
When tabbing to an element automatically triggers navigation, form submission, or a dialog, keyboard users lose control over when actions happen. WCAG 2.2 SC 3.2.1 (On Focus) is a Level A requirement: receiving focus must never automatically cause a context change. Users with motor disabilities who accidentally land on a focusable element before their intended target will trigger unintended actions — potentially submitting forms or navigating away from work in progress.
Severity rationale
Low because focus-triggered navigation is only a violation when `onFocus` handlers explicitly cause context changes — the default HTML behavior is safe, so scope is limited to explicit misuse of the event.
Remediation
Remove onFocus handlers that trigger navigation or submission. Separate the display of options from their activation — selection should require an explicit action like clicking a button.
// Bad — navigates on focus, no user confirmation
<select onFocus={(e) => router.push(e.target.value)}>
<option value="/">Home</option>
<option value="/settings">Settings</option>
</select>
// Good — selection updates state; navigation requires an explicit action
<select value={dest} onChange={(e) => setDest(e.target.value)}>
<option value="/">Home</option>
<option value="/settings">Settings</option>
</select>
<button onClick={() => router.push(dest)}>Go</button>
Search the codebase for onFocus event handlers. Any that call router.push, window.location, or form.submit are WCAG 2.2 SC 3.2.1 violations.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Accessibility WCAG Compliance Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- wcag:2.2 · 3.2.1 — On Focus
- section-508:2018-refresh · 501.1 — Scope
Taxons
History
- 2026-04-18·v1.0.0·Initial import from accessibility-wcag·automated