Website Accessibility Guide

3.3.1 Error Identification

Written by MCS Accessibility Team | Jun 13, 2020 10:56:00 PM

Understanding 3.3.1 Error Identification

As a developer you have to ensure that any users are made aware of any errors that occur and that they can determine what it is.  The error message should be as specific as possible. Just to keep in mind, error messages that popup upon form submissions is not enough for certain users to perceive that an error has occurred. Users with screen readers may not necessarily know there is an error until they come across the error indicator.

There are two different type of situations for this criteria:

  • Information submitted by the user that are required 
  • Information submitted by the user that doesn't meet the required values.

Regarding the second point above, if a user enters a value that doesn't meet the required values and the form automatically changes the value to fall within the range. The error message would still need to be provided to the user as required by this criteria. An error description letting the user know of the changed value would meet the 3.3.1 criteria as well as criteria 3.3.3 (Error Suggestion) 

Recommended Solutions

There are few ways to ensure that your website remains compliant.

For forms with required fields:

  • The developer needs to program an alert or message of any errors that is shown to the user upon form submission if there are any. In the example, shown to the right a label that states "Please complete this required field" in red is sufficient for this criteria.
  • HubSpot on their forms program in the aria role="alert" on the error label text.
  • If form fields aren't filled, In addition to displaying the error, you should highlight the fields for easier scanning.

    <ul role="alert">
     <li> <label class="hs-error-msg"> Please complete this required field.</label> </li>
    </ul>
       

For form fields that require specific data or values:

  • Again, the developer should provide context as specific as possible. In the example below "Please enter a phone number at least 7 numbers long and can contain only certain characters."
  • HubSpot on their forms program in the aria role="alert" on the error label text