Fri Mar 21 2025 10:39:40 GMT+0000 (Coordinated Universal Time)
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.
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:
Provide clear, text-based error messages to improve usability and accessibility for all users, especially those who:
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.
This section provides some pass and fail examples of this issue.
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>
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>
Error message is only communicated through color or icons:
<label for="username">Username:</label>
<input type="text" id="username" name="username" required>
<span style="color: red;">⚠</span>
Error message is missing or vague:
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
This section provides instructions on how to review and fix this issue.
Provide descriptive error messages near the input field:
<label for="card">Credit Card Number:</label>
<input type="text" id="card" name="card" required aria-describedby="card-error">
<span id="card-error" style="color: red;">Please enter a valid 16-digit credit card number.</span>
Use aria-live for real-time error updates:
<div role="alert" aria-live="assertive" id="form-error">
Error: Please correct the highlighted fields.
</div>
Ensure that errors are not only conveyed visually:
Do not only change the border of an input field to red, for example. Instead, add a text message that explains the error.
If this content did not answer your questions, try searching or contacting our support team for further assistance.