Avoid using required

Pattern Checker

What does this mean?

The form input has a required or aria-required attribute set. This is likely with the intention of informing screen-reader users that the field is mandatory.

For example:

<input type="text" id="name" name="name" required>

Note that aria-required and required should not be used together on the same element as it can introduce repetition.

Impact on users

These attributes must be used in conjunction with a visible indicator to mark a field as requiring data entry from the user.

However, in government services all fields are required by default and so only optional fields are identified as these are the exception.

To mark up all the required fields with one of these attributes (and the corresponding visual indicator) would make the interface too noisy for all users. For this reason UK government services do not typically use the required or aria-required attributes (one exemption might be when implementing client-side validation but as this can introduce accessibility issues of its own it is not recommended).

If the field does not also have the visual indicator that it is required then you are disproportionately impacting screen-reader users by adding these attributes.

How to fix

For UK government services you should remove these attributes.

If you have any optional fields they should be called out as such in the label of the field.

References

Classification

Level: info
Tagged: govuk

See all issues