RatedWithAI

RatedWithAI

Accessibility scanner

WCAG 2.1

3.2.1 On Focus

Level A success criterion

When a component receives focus, it should not trigger a change of context automatically.

Why it matters

Unexpected changes when tabbing through a page disorient users, especially screen reader and keyboard users.

Common violations

  • Forms that submit when a field receives focus
  • Dropdowns that navigate away on focus
  • Modals that open automatically when focusing a link
  • Page content that changes when tabbing to an element

Code examples

Bad

<select onfocus="window.location = this.value">...</select>

Good

<select onchange="handleChange()">...</select>
<button type="submit">Go</button>

How to fix

Trigger context changes only on explicit user actions like clicks or submissions, not on focus events.

Related criteria

Related resources

Test & fix this criterion

Use these free tools and guides to check and fix 3.2.1 On Focus violations:

Scan your site

Check your WCAG coverage in minutes

Start a free scan