Skip to content

Checkbox fires two events on click #5882

Answered by adidahiya
amcheshire asked this question in Q&A
Discussion options

You must be logged in to vote

Can you try working around it by checking event.target === event.currentTarget in handleClick?

Edit: @martijnarts's answer below and the linked StackOverflow post is helpful. There is a problem with the current design of Blueprint's control elements where this double click behavior will continue to happen if you attach an onClick handler to any parent of a <Checkbox> or <Switch>. We can fix this in a future major version of Blueprint by making <input> a sibling of <label>, but that would be a breaking change. I will consider this for Blueprint v6.0.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by adidahiya
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
3 participants
Converted from issue

This discussion was converted from issue #3466 on January 24, 2023 15:12.