JakeSidSmith / react-fastclick

Fast Touch Events for React
https://www.npmjs.com/package/react-fastclick
MIT License
487 stars 41 forks source link

Disabled attribute is ignored on touch devices #21

Closed munkyjunky closed 8 years ago

munkyjunky commented 8 years ago

When clicking on a button with the disabled attribute fastclick ignores this and triggers the click anyway, when using a touch screen (so any mobile device). This looks to be happening because the touchstart event will always fire on a disabled element whereas a click element will not.

I think the fix for this should be something akin to checking the touched element for the disabled attribute in the touchstart, and ignoring the touch if disabled is true.

Hope to make a PR for this sometime this week when I get chance, but raising this issue in case you have time to fix it first, or I never get chance to fix it.

JakeSidSmith commented 8 years ago

Oh, wow. Can't believe that's something I totally overlooked. Should be a fairly easy fix, so I'll try to sort it out today if I have time.

JakeSidSmith commented 8 years ago

24 Should fix this. If you could test it out on your app / site that'd be awesome, @munkyjunky

brins0 commented 8 years ago

It's fixed it for me, thanks a bunch dude!

munkyjunky commented 8 years ago

Yup, working now! Thanks @JakeSidSmith