Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add onClick functionality to Rating component #17921

Closed
1 task done
jmaloon opened this issue Oct 17, 2019 · 3 comments
Closed
1 task done

Add onClick functionality to Rating component #17921

jmaloon opened this issue Oct 17, 2019 · 3 comments
Labels
component: rating This is the name of the generic UI component, not the React module!

Comments

@jmaloon
Copy link
Contributor

jmaloon commented Oct 17, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.

Summary 馃挕

An onClick prop should trigger a function each time any value (selected or not) is clicked.

Motivation 馃敠

I have a form that triggers a state change when the rating value is selected. If the user clicks on a already selected value, the function is not called and the form appears broken.

Upon investigating the source code I also noticed a small typo in Rating.js. On line 357 the variable is called itemDeciamlValue - no bug because it is replicated but still a typo nonetheless.

@oliviertassinari oliviertassinari added the component: rating This is the name of the generic UI component, not the React module! label Oct 17, 2019
@oliviertassinari
Copy link
Member

oliviertassinari commented Oct 17, 2019

@jmaloon Thanks for the feedback. How can we reproduce the problem?

(Do you want to solve the typo?)

@jmaloon
Copy link
Contributor Author

jmaloon commented Oct 17, 2019

I created this sandbox to reproduce the feature request. See the console logs when interacting with the Rating component. https://codesandbox.io/s/nifty-heyrovsky-f8oq0

There isn't really a problem as it stands. Currently the onChange will on trigger the callback only if the value changes. What i'm proposing is a new feature (onClick) that would trigger on every click.

I can fix the typo and take a stab at the onClick prop if you think it is a valid feature request

@oliviertassinari
Copy link
Member

oliviertassinari commented Oct 17, 2019

@jmaloon Thank for the reproduction, the onClick callback already exists and the onChange behavior is correct. I don't see any potential for improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: rating This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

2 participants