-
Notifications
You must be signed in to change notification settings - Fork 75
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
[Rating] Unexpected component behavior after setting value as user #5312
Comments
@macandcheese the codepen seems to be incorrect for the issue. |
Wrong link - updated. It's just a single instance of a rating component, but it illustrates the issue. |
I'm not sure we should allow toggling between a set value and no value when hitting enter or clicking. Radio buttons don't usually work like that. If we want, maybe we could support the |
I'm also not quite sure while hitting enter or space needs to emit an event. It seems like a user already clicked or navigated to the value with the arrow keys and the emit has occurred. Any idea on why we need to emit again on enter or space? I think we also emit on tab out of the component. These extra events seem unnecessary to me. |
Agree on not needing the extra events while navigating. I do think enter / space / click again could be expected to clear the rating, but will defer to @geospatialem there for a11y. |
Can you elaborate on why? These are radio buttons and I don't think there is a way to clear radio buttons |
Because as a user I may want to clear the rating I’ve just set. This was the enhancement issue where it was added: #3043 I know there’s the internal hidden input / analog to the radio control but I’m not sure the UX is 1:1. Without the app building their own reset control, as a user I can’t clear my rating. |
hmmm because the way its currently set up, it doesn't really clear the value it just sets it to zero. Assuming zero is a valid value to submit. Maybe another issue is that the component has a default value of 0. So when the form is submitted that value of 0 will be submitted. Maybe it should be null? |
Yeah, if we want to remove that current "unset my rating" functionality, an option could be to have "no stars" as a navigable item alongside 1-5, but to your point there is a difference between 0 and no value (both of which could be valid or invalid in a variety of scenarios). I've seen both in the wild, components that let a user "re-select to clear", and components that have a "0 step". |
Yeah, not sure how to proceed with this one so putting it back in the box. Issues to discuss
|
For a11y I'd expect clearing of the component from a separate element from the stars. It could make it a bit more clear, both visually and for AT users to distinguish the value and what is set in the component. Perhaps something similar to W3C's star rating example? |
**Related Issue:** #5312 ## Summary Resolves bugs keyboard interaction and focus-in/focus-out Cleans up component events, state, methods, and props Refactors the component to make the value prop the source of truth and driver of the component state Refactor tests to remove duplicates and improve scan-ability. ### Before https://user-images.githubusercontent.com/4733155/189963194-da8ee607-f4a8-46bf-8e21-9b36d2aeef64.mov ### After https://user-images.githubusercontent.com/3362490/208055841-20e6630a-c2ab-43b6-815d-18f14b0cd911.mp4
Installed and assigned for verification. |
Accessibility works incredibly great, nice work! 👍🏻 @alisonailea Noticed using the |
Opened a new issue to tackle in a future upcoming release, the above issue has been verified. |
Actual Behavior
As an end-user, after interacting with the rating, there is unexpected behavior that occurs after setting (or clearing) a user-set value.
Screen.Recording.2022-09-13.at.10.00.41.AM.mov
Expected Behavior
Reproduction Sample
https://codepen.io/mac_and_cheese/pen/ZEoBWGj?editors=100
Reproduction Steps
For clear issue:
For not being able to "re select" issue:
Reproduction Version
91
Relevant Info
No response
Regression?
No response
The text was updated successfully, but these errors were encountered: