Changing context
Changes of context are predictable
When user actions unexpectedly cause a major change to a web page known as a change of context, it can disorient users who aren't able to view the entire page simultaneously or who are easily distracted by changes. Unexpected changes of context impact users with motor impairments, users with low vision who magnify the screen, users who are blind, and users with certain cognitive limitations.
A change of context includes changes of:
- User agent
- Software that retrieves and presents content, e.g., a Web browser, media player, plug-in or other program including assistive technologies. A completely separate user agent, such as an external viewer programme, opens.
- Viewport
- Content is rendered in one or more viewports. These include browser windows, browser tabs, frames, loudspeakers, and virtual magnifying glasses. Typically, a new window opens.
- Focus
- Focus refers to which interactive control on the screen -- a link, form control, button, or custom control -- currently receives input from the keyboard (and from the clipboard when you paste content). The user's focus moves unexpectedly to a different part of the current Web page.
- Content that changes the meaning of the Web page
- This includes significantly re-arranging the content of a page.
As discussed in the following sections, changes of context must never be triggered on focus, and must be anticipated by the user if triggered by changing the setting of a control (on input).
On focus
Keyboard users navigate from interactive item to interactive item using the Tab key, moving focus from one item to the next. A component that triggers an event when it receives focus must not change the context. For instance, a control that receives focus must not trigger changes in context such as:
- Causing a form to submit automatically
- Causing a new window to launch
- Causing focus to change to another control
The design goal is predictability. Give the user control over changes of context with an explicit user action that's generally understood to cause a change of context; e.g, clicking a link or pressing a submit button.
Related WCAG resources
Related WCAG resources
Success criteria
Techniques
Failures
On input
Changing the setting of a user interface component must not cause a change of context. Examples of changing a setting include checking a checkbox, entering text into a text field, or changing the selected option in a <select>
element. Clicking on links or tabs in a tab control is activating the control, not changing the setting of that control.
Again, the design goal is predictability. There are two options:
- Give the user control over changes of context with an explicit user action that's generally understood to cause a change of context; e.g, clicking a link or pressing a submit button.
- Describe to the user how interacting with the control changes the context, before the control is encountered.
Related WCAG resources
Related WCAG resources
Success criteria
Techniques
- G80: Providing a submit button to initiate a change of context
- G13: Describing what will happen before a change to a form control that causes a change of context to occur is made
- SCR19: Using an onchange event on a select element without causing a change of context
Failures
- F36: Failure of Success Criterion 3.2.2 due to automatically submitting a form and presenting new content without prior warning when the last field in the form is given a value
- F37: Failure of Success Criterion 3.2.2 due to launching a new window without prior warning when the selection of a radio button, check box or select list is changed