Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Do not rely on color alone to convey the error or alert message when something is not completed correctly or missing. 

Provide a description of and the nature of the error message as well as an anchor link to the location of the error messageand how to correct it. Example: “Please provide the correct date of birth. The primary applicant must be 18 years of age or older”.

Non-Compliant Error Message Treatment

...

 

Compliant Error Message Treatment

...

 

Provide inline error messages to let the user know right away when a form element has not been completed or filled out correctly (when form control loses keyboard focus).

...

Using ARIA to Create Accessible Inline Error Messages

Make inline error messages accessible to screen reader users by adding ARIA labels.

  • Most screen reader and browser combinations announce a form control as “required” when using the required attribute.

  • Prevent screen readers from announcing required form controls as invalid by default, by using aria-invalid="false".

  • Update the aria-invalid attribute to “true” if the current value (or lack of value) of a required control does not pass validation.

  • Wait to declare form controls as invalid and display inline error messages once the control has lost focus, or there has been an adequate delay in key presses (a few seconds)

  • Use aria-describedby on required form controls to point to an element that will contain any necessary inline error messaging.

  • Can’t always rely on browser’s client-side error validation to be accessible.

  • Create a custom client-side validation script and helpful messaging by suppressing the browser’s default validation message by adding the novalidate attribute to the  form element. 

Code Examples:

Default Error Message Treatment

...

https://codepen.io/TPG/pen/3b68c22db120c0960503fe892bb2c068

Provide Users With a List of Error Messages

In addition to using inline error message treatments it can also be helpful to list out the error messages at the top of the form.

Provide direct links to the form elements that require input or need to be corrected.

This is especially helpful when multiple required form fields have been left empty by the user. 

The list of error messages can be triggered once the user has attempted to submit the form.

...

Declaring Form Controls as Invalid

...