-
Notifications
You must be signed in to change notification settings - Fork 13
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
fix: Updates number component to have more consistent UX #4897
base: main
Are you sure you want to change the base?
Conversation
🧪 Review environmenthttps://47pohtsyxdtssbbbsqptibcxnm0wzqky.lambda-url.ca-central-1.on.aws/ |
Looks like it's accepting text chars ? https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation |
Form validation would fail if it's not a number like in your example. Do you think more immediate validation or constraints would be helpful? PS: Oh and Hi :) |
Looks good -- @connorscarolyns will wait to approve until you have a look as well. |
I think it works ok, It will be interesting to see how it tests. The screen reader announcing might be a bit confusing because it says it's a text field and to enter text, but nothing about it only accepting numbers. |
I also notice that the UK does not use the pattern attribute, and has added a spellcheck false. Do we have reasoning for or against these differences? |
The pattern attribute is used by JavaScript to validate what’s entered as a number but I can move/hide this in the JavaScript. We can add spellcheck though if we restrict to only numbers it may not have much value. Still doesn’t hurt. I think that’s a good point that the input is not announcing itself as a number. So a user could try to enter characters that are not a number and have no idea why it wasn’t entered. One solution would be to add an aria-label and override the input semantics. This way it would announce as a number. E.g. with an aria-label=”number” I wonder if the solution is becoming complex with the added JavaScript to restrict a number and aria to redefine an input text as a number? Vs. Just checking if an input is a number on submit and hopefully that input has hints it should be a number. I’m kind of on the fence. |
@connorscarolyns actually what if we were to go ahead with the JavaScript to restrict entering to a number and adding an aria-label to identify the input as a number and see what happens in future user tests? |
@thiessenp-cds I like your approach. You may be right about overcomplicating things, but user testing will show if there are issues. I'm fine with it how it is and will log any further concerns when we retest the next time. |
Summary | Résumé
Updates number component to have more consistent UX.
Test
Create a form with a Number component. Try entering a number, it should be read correctly in a screen reader. Try entering not a number, form validation should fail for the Number component.
e.g.
Screen.Recording.2025-01-02.at.1.39.29.PM.mov