govuk-design-system
govuk-design-system copied to clipboard
It's not clear how to handle/prioritise multiple errors
From support (paraphrased):
It's not clear what to do if multiple errors occur in the same field. Should we prioritise them one by one or tell the user about all of them?
Examples of the problem:
Thanks Joel for writing this up and including the images. I'll explain the images for the benefit of people that can't see them.
The first image shows a field for 'Phone number. The user left the field blank. It has three errors between the field label and the field. The error messages are 'This field is required', 'Minimum length is 11', and 'Please use numbers only'.
We spotted this during an update to a service. According to a dev: play software out-of-the-box will list all errors it thinks apply. If the field is blank the user should only be told the field is required. So that's a simple fix. If the field is blank, the user will only see one error message. We will also change the message to make it describe the field. Thus instead of 'This field is required' it will be something like 'Enter a phone number'.
The second image shows the same field for 'Phone number. The user put an asterisk in the field. It has two errors between the field label and the field. The error messages are 'Minimum length is 11', and 'Please use numbers only'. This is the key issue. I've never seen any guidance about how to handle multiple errors for the same field. I can see several options: (1) Show each error that applies even if it means multiple errors near the field and in the error summary. We rejected this because we didn't have any guidance showing it. We are on a tight deadline with limited resources trying to meet accessibility requirements. If we showed multiple errors we'd have to have assurance that it's accessible and we have no such assurance. (2) Create an error message for each permutation of error so the user only ever sees one error message. We rejected this because it's a lot of work, scales badly, and has a poor user experience. (3) Only show one error at a time. We decided to apply this option. It is consistent with current guidance that only ever illustrates a single error. It means we don't have to treat a blank field error as a special case. The disadvantage is a user may have to try multiple times to get things right without knowing the requirements. I've seen this happen with tough and obscure password rules.
What do others think?
The following guidance on multiple errors exists:
If there’s more than one error, show the highest priority error message. In order of priority, show error messages about: missing or incomplete information information that can’t be correct (for example, the number ‘13’ in the month field) information that fails validation for another reason
See https://design-system.service.gov.uk/components/date-input/#error-messages
Would I be right in thinking that applies more broadly than just dates?