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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Checkbox): prevent onChange and onClick when disabled #600

Closed
sprmn opened this issue Oct 3, 2016 · 2 comments
Closed

fix(Checkbox): prevent onChange and onClick when disabled #600

sprmn opened this issue Oct 3, 2016 · 2 comments

Comments

@sprmn
Copy link
Contributor

sprmn commented Oct 3, 2016

Version
0.52.2

Steps to Reproduce

  1. Create checkbox with prop disabled set to true.
  2. Try to toggle and check if the onChange function is called

Expected
The Checkbox should not trigger the onChange function when disabled, since it doesn't change.

Result
The Checkbox does call the onChange function.

Testcase
http://codepen.io/sprmn/pen/JROPjO

@levithomason
Copy link
Member

Thanks for the superb bug report! Indeed, neither onChange nor onClick should fire. I've updated the test case to show both handlers and included a vanilla checkbox for comparison.

Our component should be fixed to work like the vanilla component: http://codepen.io/levithomason/pen/zKPGJW

@levithomason levithomason changed the title fix(Checkbox): onChange is called if checkbox is disabled fix(Checkbox): prevent onChange and onClick when disabled Oct 3, 2016
@sprmn
Copy link
Contributor Author

sprmn commented Oct 3, 2016

Thanks! Didn't know think about onClick. Guess my fix in #601 is not sufficient yet. I'll try to add some more fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants