abpetkov / switchery

iOS 7 style switches for your checkboxes
http://abpetkov.github.io/switchery/
2.06k stars 479 forks source link

Double onchange event with label #160

Open Badestrand opened 6 years ago

Badestrand commented 6 years ago

Hi

It is a known issue that Switchery fires the onchange event twice when it is inside a label <label><input ..></label>. Issues #50 and #51 were about this, for example.

I am using Switchery again currently and am annoyed by that behaviour. I would like to commit a pull request to fix it but before I do the work in vein I would like to know: Would you (the mods) accept and merge the pull request if it fixes the issue and looks reasonable?

Or this there any problem I should know about why this wasn't fixed yet? Maybe it is harder than it looks (just prevent event propagation on click)?

And thanks for this project, I really like using it!

jirikrepl commented 2 years ago

Hi, I fixed this in my fork. https://github.com/jirikrepl/switchery/commit/174cb248c7504f5b1e9bf1b87579b7861d2af212