aaronshaf / react-toggle

Elegant, accessible toggle component for React. Also a glorified checkbox.
http://aaronshaf.github.io/react-toggle/
MIT License
945 stars 159 forks source link

Fix disabled toggle touch #154

Closed tremby closed 4 years ago

tremby commented 4 years ago

In both Firefox and Chrome with touch enabled (both on desktop and mobile) I'm able to toggle toggleswitches even on disabled toggles.

The first commit adds what was supposed to be a failing test, but the test passes (false negative). I am not sure why.

The second commit returns from the handleClick and handleTouchStart functions if the control is disabled. This fixes the bug for me in manual tests. (And the faulty test still passes.)

aaronshaf commented 4 years ago

Thanks @tremby. I also sent you a collaborator invite link.

tremby commented 4 years ago

Thanks. Do you have any idea how to make the broken test useful?