-
Notifications
You must be signed in to change notification settings - Fork 328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Investigate adding 'aria-invalid' attribute on form inputs that have errors #1168
Comments
Based on running Based on a GitHub search across alphagov repos, I can't find any issues discussing the use of |
@36degrees I think your idea to add a visually hidden 'Error: ' to the error next to the form field is still worth considering. This would also make the |
Based on the guidance quoted in the initial post, I am reasonably confident that aria-invalid is not something we need to add to invalid fields. It'd be good if someone else could take a look at the guidance and see if they come to the same conclusion. |
I agree, it seems like this attribute can be used as a last resort, if there's no descriptive error already.
|
Thanks, @NickColley! |
What
Investigate whether adding the
aria-invalid
attribute to form inputs helps users using assistive technologies to identify form fields that contain errors.Why
In GOV.UK Elements we used to suggest considering using aria-invalid:
This information is not in the Design System. We should consider if this advice is still relevant, and, if possible, make it clearer and provide examples. For example, in which situations is it important to use the
aria-invalid
attribute?Who needs to know about this
Developers
More information
Using aria-invalid to identify error fields is one technique that can be used to meet Success Criterion 3.3.1: Error Identification. This criterion was present in WCAG 2.0 – it is not part of changes introduced in WCAG 2.1.
The guidance on using this technique states that:
Based on this description, it appears that we may not need to add
aria-invalid
because we are already using multiple other techniques to identify errors:role=alert
, which describes any error(s) found in the form.aria-describedby
.It may be that using
aria-invalid
is redundant, and may even be overly verbose for users. However, we should do the work to better understand its use and document it.When the Design System and its examples were audited against WCAG 2.0 in June 2018, no issues relating to success criterion 3.3.1 were found. However, the rating against this criterion was recorded as 'Not Applicable (N/A)' suggesting that 'no content was found on the service to which the checkpoint would relate' – it may be that the examples in the Design System were not realistic to trigger an audit against this point.
The text was updated successfully, but these errors were encountered: