Level
A
Since
WCAG 2.0
/ WCAG criterion

3.2.1 On Focus

Moving focus onto something, by tabbing or clicking into it, must not by itself open a window, submit a form, load a page or throw focus somewhere else.

/ What it requires

Receiving focus is how a keyboard or screen reader user arrives at a control before deciding what to do with it. This criterion says that when any user interface component receives focus, that alone must not initiate a change of context. W3C names forms submitted on focus, new windows opened on focus, and focus moved on to another component as examples. A change of context is a major change: a new page, a new window, focus moving elsewhere, or content rearranged so that the page means something different. People who tab through a page, and people using magnification or a screen reader, lose their place when that happens.

Focus can arrive by keyboard or by clicking into a field; hovering does not move focus unless a script makes it. Clicking a button both focuses and activates it, and the activation may change the context, which is allowed. A change of content that is not a change of context, such as a hint appearing below a field or a menu expanding while focus stays put, passes. The criterion has no exceptions and, unlike 3.2.2 On Input, offers no way out through a warning given in advance.

/ How pages fail it

  • A help dialog opens whenever a field receives focus and takes focus with it, so a keyboard user can never tab past the field.
  • A link or button calls this.blur() in an onfocus handler to hide the focus ring, which throws focus off the element.
  • Tabbing onto a "Done" button submits the form and loads the next screen without the button being pressed.
  • A pop-up window opens when a link in the navigation receives focus.
  • Focusing the search field in the header sends the person to a separate search page before they type anything.

/ How to check it yourself

  1. Start at the top of the page and press Tab through every element without pressing Enter or Space. Watch for new windows, page loads, form submissions and focus jumping somewhere you did not send it.
  2. Repeat with Shift+Tab, and click into each text field with the mouse, since focus that arrives by pointer counts too.
  3. Open custom widgets such as menus, date pickers and comboboxes by focus alone. Anything that appears is fine as long as focus stays where it was and the page keeps its meaning.
  4. In the developer tools, search the scripts for focus and focusin handlers and onfocus attributes that call submit(), window.open() or blur(), or that set location.
  5. Tab through again with a screen reader such as NVDA, and note any point where the announcement jumps to a different part of the page.

/ How to fix it

  • Trigger changes of context from activation, the click event of a button or a link, never from focus or focusin.
  • Remove blur() calls from focus handlers, and style the focus indicator with :focus-visible instead of taking focus away.
  • Show help for a field inline, as text below it linked with aria-describedby, rather than opening a dialog when the field is focused.
  • Open new windows only from a link or button the person activates.
  • If a search field leads to a full search page, go there when the search is submitted, not when the field is focused.

/ What our scanner checks

No rule in our scan is filed under 3.2.1. The rendered engine does focus tab stops one by one while it measures 2.4.7 Focus Visible, but it does not record what focusing caused, and an element that refuses to keep focus is passed over as not focusable rather than reported. The HTML_CodeSniffer sniff for 3.2.1 raises only a notice, which the scan drops. Tabbing through the page and judging each consequence is part of a manual audit.

/ Who fails it, in our own measurements

The weekly index has no figures for this criterion, because none of the checks the site scan runs can test it. A person judges it, which is what a manual audit is for.

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

What is the difference between 3.2.1 On Focus and 3.2.2 On Input?

3.2.1 is about a component receiving focus. 3.2.2 is about changing its setting, such as choosing an option or ticking a box. On Input allows a change of context if people are told about it before they use the control. On Focus has no such clause, so focusing a component must never trigger a change of context.

Can a menu or tooltip open when an element receives focus?

Yes, if it is a change of content and not a change of context. Showing a tooltip, expanding a submenu or revealing a hint is allowed as long as focus stays on the element and the page keeps its meaning. It fails when opening it moves focus, opens a new window or loads another page.

Does clicking a button that opens a new page fail On Focus?

No. A click both focuses and activates a button, and it is the activation that changes the context, which the person asked for. The criterion is about focus alone, as when someone tabs onto a button and something happens before they press it.