BEFORE“Invalid email” appears visually, but the field is not associated with the error and the change is not announced.
User impact A screen-reader user may not know which field needs attention or how to correct it.
THE FIXAssociate the error with the field, update the invalid state, and communicate the new message appropriately.
Form code example<input id="demo-email" type="email"
aria-invalid="true"
aria-describedby="email-error">
<p id="email-error">
Enter an email such as alex@example.com.
</p>
A connected label is also required. Validation updates the error message and invalid state; the example uses a polite status message and moves focus to an invalid field.