-
Notifications
You must be signed in to change notification settings - Fork 34
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
[SCREENREADER]: Inline error messages are announcing to screen readers on correction, not on subsequent errors #278
Comments
Just noting here that we don't seem to use a lot of |
@dmethvin-gov I've been thinking about the |
@1Copenut decision from our meeting with Chris J, James K, Alex T: let's fix this the right way, even though it's a significant lift, and solve through the forms library. Can you please make sure there's an issue in the Team Repo for this, in the Ready column w/a brand consolidation label, w/a description of the solution, and an estimate of the risk/complexity/difficulty? Ping me (Rachael Roueche) in Slack when done so that Chris and I can move this issue up in our list of work to tackle! |
@dmethvin-gov I have been experimenting with a few options and have asked the team I work with for assistance. I will follow up here when a best option has been settled on. Thank you for the opportunity to contribute. |
From what I can gather from "teh internez" we need to set |
Adding aria-invalid is straightforward enough. The sticking point here looks mainly like re-announcing an error when you blur an input. Our errors already use an alert role and get announced when that text changes, but if that error text doesn't change (like if you blur an input without fixing it), then it doesn't get read again. I'm not sure how we could force that div to be cleared and re-populated to trigger the error being read, in the React component tree. |
Yes, the main sticking point is JAWS + IE11 reading the error message twice. In the current scenario, if an I did some testing on a local mockup to see if I could re-create the issue, and I was able to do so. If the error message is removed when the input received focus, JAWS reads the error message immediately, then re-reads the input label. IMO, this is a preferable situation to reading the error message a second time after users have typed in potentially accurate information. If there's a preferred way to share code samples (Codepen, Code Sandbox) I'll drop my findings there and update this comment with a link. |
Removing the error message on focus is going to be confusing for sighted users, especially if we set focus to the first field with an error. They will end up in the invalid field without a visual description of the error. Would it work to clear the error on the first change (generally, an input keystroke) to the field after it's been focused? That would be the HTML "input" event which corresponds to the React "onChange" event. |
I'm a little confused about how JAWS is reading an error message when you enter a valid entry. The error message is removed as soon as valid data is entered, so it shouldn't exist for JAWS to read. Is it a timing thing, in that JAWS is reading out the error message and it isn't interrupted if the user fixes the data before it finishes? I can't reproduce that issue in VoiceOver, so it's hard for me to test out solutions. |
JAWS and IE11 is keying on the Removing the error on first change seems a good balance for sighted and assistive device users. I'm going to modify my local test because I'm curious how JAWS handles it, and will report back when I have a better understanding. |
@1Copenut is it just JAWS that does this, or do some of the others do it as well? |
@dmethvin-gov It is just JAWS, when coupled with IE11. I haven't seen it with other browser + screenreader combinations. I just hit on an experiment that might solve the issue, basically creating the error It works in preliminary findings, but not quite ready for sharing. I'll post it up later today when I've had a chance to confirm it works on all browser + screen reader pairings. |
@dmethvin-gov I had a chance to go back to the experiment I was working on, and might have something. It's on Codepen here: https://codepen.io/tpierce_402/pen/Lqezye I discovered in testing that creating a Visual users could have the same experience where the error doesn't drop out until they start typing. Aural users will hear Field name, invalid text entry. The error message will fire again when the field is blurred if the input is invalid or empty. The code is just proof of concept, so I could test it as easily as possible. Let me know if it'd be better to fold it into a branch on the US-forms-system repo. Tested on:
|
Opps. Accidentially moved this into in progress. Sorry. |
Audit Information
Describe the bug
Form inputs have inline error messages that are designed to announce themselves to screen readers when an input is invalid or empty. The error messages are firing correctly when inputs are blurred, but are announcing when users re-focus the input and provide a valid entry. The inputs are also not announcing the error message when users provide a second invalid entry.
To Reproduce
input[type="text"]
which is where the behavior was notedTAB
or arrow keysExpected behavior
The error message should be announced to screen readers when an input is blurred with invalid or empty data. The error message should fire a second time when invalid data is entered a second time, but should not announce when users enter valid data to correct the first error.
Screenshots
The text was updated successfully, but these errors were encountered: