-
Notifications
You must be signed in to change notification settings - Fork 945
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
USWDS - Input Mask: (Error Feedback) Code Refactor #6203
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mejiaj thanks for the draft feedback! Good catch on that bug :O |
I think it has something to do with holding down the shift button. I will add this edge case - good catch! |
I'm working on refining the error message so that a screen reader user understands their invalid character was not added to the input. There was some confusion from users if they needed to backspace or not (and they don't need to). I'm wondering if updating the message to say "Error: please enter a number. Your last entry was not added to the value." is descriptive enough OR if we need to adjust functionality to read them back their whole input like "Error: please enter a number. Currently the input value is "a1b 2c" I notice in VO it reads the new full input value after a character has been accepted, but not when it's rejected. Thoughts? |
I prefer your second wording. And in JAWS typically nothing is read aloud for me unless I backspace to hear it. Most JAWS and NVDA users I suspect will be used to arrowing backwards to hear each character. That said, hearing the entire data field announced sounds like a great enhancement! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found a couple more behavior issues while testing screen readers! Also going to take a quick look at unit tests to see if I can help get them unblocked
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mlloydbixal thanks for all your work on this so far. The previous special character and keyboard combination issues have been fixed.
What I tested
- Error message visual issues
- Special characters and navigation keys are fixed
- Paste shows an error if input is incorrect
Additionally added comments for code style and suggestions for clarity.
Summary
Improve invalid character feedback with error message. Add error messages (customizable via data attributes) to give proper user feedback when an invalid character is not added to the input value.
Breaking change
This is not a breaking change however there two minor warnings to note:
Related issue
Closes #5481
Related Pull Request
USWDS-Site: Add changelog for input mask [#6203]
Preview link
Preview link
Problem statement
The current state of the input mask component does not provide any audio feedback and very little visual feedback to the user that the character they attempted to add to the input value was rejected. Usability testing showed they were often unaware that the characters were not allowed. The desired state would be feedback to the user via an error message and the appropriate aria-labels that offer context that their input was rejected, what the current state of the input now is, and what the input is expecting from them. This issue affects every user.
Solution
The solution is to provide an error message that is descriptive and dynamic enough so that it updates the user on what the input mask is expecting of them whether it is a letter or a number. Additional aria labeling will provide the same context to screen readers in a message that can be customized separately to give additional instruction if necessary.
Testing and review
Navigate to text input mask component (alphanumeric is best for testing all the error message types at once but the others should still be tested for regression)
*Paste tests should only be done with keyboard, issues with paste click events will be covered in a seperate issue
*When error message does not display it should also be hidden with no visual padding or styling
*There should be no regressions or changes to mask functionality outside of partial improvements to paste functionality. This is only an error message enhancement.