This success criteria states that website owners must provide a descriptive notification of errors that occur when a user incorrectly fills out a form field.
What
When a user fills out a form, any errors in their input must be clearly described in the error message text. If a mistake such as a missing required field or an invalid format is detected, the user must receive a text-based error message that explains what went wrong and how they can fix it.
The error message must:
Highlight the specific field with the error.
Clearly explain what is wrong, for example, Email address is required.
Provide guidance on how to fix the issue, for example, Please enter a valid email in the format: [email protected].
Why
Why is this important?
Provide clear, text-based error messages to improve usability and accessibility for all users, especially those who:
Use screen readers: Audio feedback helps these users understand the issue.
Have cognitive disabilities: Clear instructions reduce confusion.
Rely on keyboard navigation: These users may not notice visual cues such as color changes on an incorrectly submitted form field.
If an error message is only conveyed through color or icons, users with visual impairments might miss it. Ensure that the message is presented in text.
Examples
This section provides some pass and fail examples of this issue.
Pass examples
Error message displayed in text and linked to the input field
<label for="email">Email Address:</label>
<input type="email" id="email" name="email" required>
<span id="email-error" style="color: red;">Please enter a valid email address.</span>
Why this works:
The error message is in text and clearly describes the issue.
It is associated with the input field, which helps assistive technologies relay the error.
Use aria-describedby to associate an error message with an input field
<label for="phone">Phone Number:</label>
<input type="text" id="phone" name="phone" aria-describedby="phone-error">
<span id="phone-error" style="color: red;">Phone number must be in the format (123) 456-7890.</span>
Why this works:
The error message is linked to the input field, which makes it accessible to screen readers.
Fail examples
Error message is only communicated through color or icons:
This success criteria states that website owners must provide a descriptive notification of errors that occur when a user incorrectly fills out a form field.
What
When a user fills out a form, any errors in their input must be clearly described in the error message text. If a mistake such as a missing required field or an invalid format is detected, the user must receive a text-based error message that explains what went wrong and how they can fix it.
The error message must:
Highlight the specific field with the error.
Clearly explain what is wrong, for example, Email address is required.
Provide guidance on how to fix the issue, for example, Please enter a valid email in the format: [email protected].
Why
Why is this important?
Provide clear, text-based error messages to improve usability and accessibility for all users, especially those who:
Use screen readers: Audio feedback helps these users understand the issue.
Have cognitive disabilities: Clear instructions reduce confusion.
Rely on keyboard navigation: These users may not notice visual cues such as color changes on an incorrectly submitted form field.
If an error message is only conveyed through color or icons, users with visual impairments might miss it. Ensure that the message is presented in text.
Examples
This section provides some pass and fail examples of this issue.
Pass examples
Error message displayed in text and linked to the input field
<label for="email">Email Address:</label>
<input type="email" id="email" name="email" required>
<span id="email-error" style="color: red;">Please enter a valid email address.</span>
Why this works:
The error message is in text and clearly describes the issue.
It is associated with the input field, which helps assistive technologies relay the error.
Use aria-describedby to associate an error message with an input field
<label for="phone">Phone Number:</label>
<input type="text" id="phone" name="phone" aria-describedby="phone-error">
<span id="phone-error" style="color: red;">Phone number must be in the format (123) 456-7890.</span>
Why this works:
The error message is linked to the input field, which makes it accessible to screen readers.
Fail examples
Error message is only communicated through color or icons: