-
Notifications
You must be signed in to change notification settings - Fork 37
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
🐛 Issues with Checkbox onClick event #1027
Comments
For one I think that indeed the checkbox value should be synced with the input value. As for the double onClick firing, what if someone wants to click on the label and retrieve it's text? Removing the onClick does not seem to be the right approach. |
Hey @tjosepo! Indeed it should not be fired twice and the value should match the current value. I can't remember if it's doable thought given how the component is currently structured or if it would requires a rewrite of the component. The double click and the wrong target value are happening because the Most of the time, I add additional properties for sub elements:
Not sure if it should be done or not for this one. What's your use case? For the example you provided, you are expected to use |
I think you're right, However, the reason I couldn't use them is because they did not fire consistently when holding the Shift Key. I was working on a page that let you hold shift to select multiple checkboxes. |
Oh, interesting. Indeed it does work most of the time when holding the Shift Key but it seems to hang from time to time. That's odd. IMO this is the real bug, would you mind renaming this issue to phrase it around the Shift Key issue? The other issues you discovered could also be fix while fixing the shift key issue:
|
Describe the bug
The
Checkbox
component has some odd behaviors when compared to<input type="checkbox" />
, when reacting to a user input.input
element.event.target.value
of the checkbox is always set to"on"
, even when avalue
prop is specified.These issues make working with the
onClick
event difficult.Steps to reproduce
Expected results
onClick
event fired, targetting theinput
DOM element.event.target.value
is equal to thevalue
prop of theCheckbox
element.Reproducible demo
You can copy/paste the code from this issue in the Orbit Storybook.
The text was updated successfully, but these errors were encountered: