on-focus
An element receiving focus must not trigger actions such as location change, the page structure, or the state of the focused element.
Description
The focus state is a visual cue that shows an element is ready for user interaction. When gaining focus automatically causes a "change of context", such as navigating to a new page, opening a modal, or submitting a form, it makes the interface unpredictable. This can disorient users who rely on keyboard navigation, screen readers, or have cognitive disabilities. Such unexpected behaviors may make the interface difficult to understand and use.
Quick Fixes
Ensure that significant changes to the interface (like the ones detailed above) only occur when the user actively triggers them, for example, by pressing a button or a key like Enter or Space. They must never be the result of an element simply receiving focus.
Fail Patterns
1. Modal opens on focus
2. Checkbox being checked on focus
Elements must not update their state as the result of receiving focus.
How Users Are Affected
Unpredictable behavior caused by element receiving focus may disorient keyboard-only users and screen reader users, who rely on a consistent, predictable flow to navigate. It is especially problematic for users with cognitive disabilities, who may become confused or lose their place, as well as for users with motor disabilities who may struggle to correct an accidental action or navigate out of an unexpected situation.
WCAG Success criteria
This issue might cause elements to fail one or more of the following Success criteria:
3.2.1 On Focus (A)