On Input: Form Controls Without Surprises
Also called: Change on input, Auto-submit, Unexpected change of context
Definition
On Input is WCAG success criterion 3.2.2. Changing the setting of a user interface component – typing in a field, choosing an option, ticking a checkbox – must not automatically cause a change of context unless the user has been advised of the behavior before using the component.
On Input is the WCAG rule that filling in a form must not trigger unexpected jumps. Choosing a country in a select list, ticking a checkbox or typing a digit should change exactly that – not submit the form, load another page or open a window, unless users were told beforehand. It makes forms predictable and keeps people in control of when something happens.
What it means
WCAG 3.2.2 On Input is a Level A criterion of WCAG 2.2. It says: changing the setting of any user interface component does not automatically cause a change of context unless the user has been advised of the behavior before using the component.
A setting is a value or state that stays after the user leaves the control: the text in a field, the selected option in a list, the state of a checkbox or radio button. Links and buttons are not settings – activating them is supposed to do something.
A change of context is a major change of the user agent, the viewport, the focus, or content that changes the meaning of the page. Showing extra fields inside the same form is a content change and allowed.
| After the user changes a setting … | Allowed under 3.2.2? |
|---|---|
| More fields appear in the same form | Yes |
| A total price updates | Yes |
| The form is submitted automatically | No (failure F36) |
| A new window opens | No (failure F37) |
| Another page loads | No, unless announced first |
| Focus jumps to the next field | Only if explained before the form |
People using a screen reader or screen magnifier often don't notice that the page changed. Keyboard users browsing a select list with the arrow keys can trigger a change with every key press – before they reach the option they want.
Examples
<!-- Bad: picking an option loads a new page right away -->
<select onchange="location.href = this.value">
<option value="/en">English</option>
<option value="/de">Deutsch</option>
</select>
<!-- Good: the change happens when the user presses the button -->
<form action="/language">
<label for="lang">Language</label>
<select id="lang" name="lang">
<option value="en">English</option>
<option value="de">Deutsch</option>
</select>
<button type="submit">Change language</button>
</form>W3C names another passing example: a phone number form that moves focus to the next field automatically – because the form explains this behavior at its start. Telling users first (technique G13) is the alternative when a button is not wanted.
Use a submit button for actions that load pages or send data. Update content inside the form – extra fields, totals, form labels with hints – without moving focus. If a control must cause a change, say so in text before the control.
Submit a form when a value is entered or a radio button is chosen. Don't open a new window from a checkbox, radio button or select list without warning. Don't jump focus between fields without telling users first.
How to check On Input
Questions
Is auto-submitting a form after the last field allowed?
Not without warning. W3C lists automatically submitting a form without prior warning when its last field is given a value as failure F36. Add a submit button, or tell users before the form that it will be sent automatically.
Can a select list update the page without a button?
Yes, if the change stays within the page context – for example filtering a list below or showing extra fields. W3C technique SCR19 describes using onchange this way. Loading a new page from the list is a change of context.
What is the difference between On Input and On Focus?
On Focus (3.2.1) covers what happens when an element only receives focus. On Input (3.2.2) covers what happens when a user changes a value or state. Both forbid unexpected changes of context.
Does showing an error message break On Input?
No. An error message near a field is a content change, not a change of context. Make sure it is clear and announced – see error identification for how errors should be shown.
How can I find form problems on my website?
Behavior on input needs a manual keyboard test. Missing labels and other form errors can be found automatically: allyWay's free WCAG scanner checks a page and lists them.
Related terms
On Focus: No Surprises When Elements Get Focus
On Focus is WCAG success criterion 3.2.1. When any user interface component receives focus, it must not initiate a change of context – such as submitting a form, opening a new window or moving focus elsewhere.
Read definition: On Focus: No Surprises When Elements Get FocusForm Labels: Clear Labels and Instructions
Form labels are the visible texts that name what a form field expects, such as “Email address”. WCAG 3.3.2 requires labels or instructions wherever content asks for user input, including formats and required fields.
Read definition: Form Labels: Clear Labels and InstructionsError Identification: Clear Form Error Messages
Error identification means that when a website detects an input error automatically, it points out the field in error and describes the problem to the user in text. It is required by WCAG 3.3.1 at Level A.
Read definition: Error Identification: Clear Form Error MessagesInput Purpose: Autocomplete for Personal Data
Input purpose is WCAG success criterion 1.3.5 Identify Input Purpose: the purpose of each input field that collects information about the user can be programmatically determined, for example with the HTML autocomplete attribute.
Read definition: Input Purpose: Autocomplete for Personal Data