department-of-veterans-affairs / va-forms-system-core

VA Forms System Core will be a React library hosted in NPM that will allow engineers and designers to easily interact with Forms inside of vets-website.
https://department-of-veterans-affairs.github.io/va-forms-system-core/
6 stars 4 forks source link

VA Forms System Core [Discussion]: Global - How should multiple errors be handled and when should errors be triggered? #557

Closed TiffanyPender closed 2 years ago

TiffanyPender commented 2 years ago

Issue description

Currently, the form errors get announced with role="alert", however, there are some ways the experience could be improved.

  1. The errors are vague. They all say something like "Please provide a response". This could be because this is a demo form, and if that's the case, no problem. However, if this is a default setting for the components, we should rethink that. Let teams define that on their own using our content guidelines. Moved to ticket #586
  2. ~~When do we trigger errors? Currently, errors get triggered if a field is blank. While this makes sense conceptually because veterans can't submit blank data on required fields, it creates challenges for people who use assistive technology. People who use screen readers may often quickly tab through the fields without filling them in to understand what's on a page. When errors get triggered during that process, it becomes overwhelming. How might we design to respect that way of scanning a page? Some ideas: a. Trigger errors on "Continue" button press. b. Only trigger errors after a person leaves a field if data is in it. In other words, only trigger errors on blank fields when "Continue" is pressed.~~ - Moved to ticket #588
  3. ~~How should we handle multiple errors? Currently, the form doesn't make a distinction between one error on the page or multiple errors. Nothing happens when you press "Continue" or "Previous" and inline errors are present on the page. We could handle this better for an improved experience. Some ideas: a. Have an error summary component that summarizes errors on the page at the top if a page has multiple questions/fields. Shift focus there on button press. b. Shift focus to the top most error on button press.~~ - Moved to ticket #587

Environment

Steps to Recreate

  1. Visit the Forms Library Core demo form
  2. Navigate through each step in the form with required fields
  3. Verify the error handling experience
obliviga commented 2 years ago

Here is an error summary component from the UK government design system that we could potentially reference: https://design-system.service.gov.uk/components/error-summary/

taylorkaren commented 2 years ago

Notes from the discussion we had about this topic in the 8/11/22 Preliminary Findings meeting:

Error messages work functionally, but we can improve the experience when there are multiple errors on the page at a given time (how do we manage that for people?)

taylorkaren commented 2 years ago

Notes taken in the 8/18/22 Accessibility audit issue review and discussion meeting:

taylorkaren commented 2 years ago

Discussed this ticket with @humancompanion-usds during the 8/23/22 PO Sync call. Matt will add a comment to this ticket summarizing the way forward on this issue.

humancompanion-usds commented 2 years ago

A couple of thoughts here:

I agree with Tiffany that we should be able to "start with better text explaining what the errors are". Let's at least do that.

I still feel that summarizing the errors at the top is preferable to not doing that. We will need to do research to figure out if a complete summary is necessary or whether a count of errors or some briefer message is sufficient. We'll either look to find a VFS Team to try that out or get to it ourselves in the future.

I haven't had a chance yet to talk to the DST about what it would take to allow for tabbing through form fields without throwing errors. I believe we all agree that a minimum entry should be necessary before firing an alert. I just don't know technically across all of our form components how far we are from that behavior today (i.e. how many components we would we need to refactor). I believe we just did this for the new Memorable Date component so, it should be possible. I will file an issue for that for the DST to mull over.

taylorkaren commented 2 years ago

"start with better text explaining what the errors are" is now ticket #586. Research ticket for "summarizing the errors at the top" is now ticket #587.

tabbing through form fields without throwing errors" is now ticket #588.

taylorkaren commented 2 years ago

Split this ticket into three tickets (see comment above) for easier tracking. Will close this ticket as issues will now be tracked on the new tickets.