ten1seven / what-input

A global utility for tracking the current input method (mouse/pointer, keyboard or touch).
https://ten1seven.github.io/what-input
MIT License
1.36k stars 77 forks source link

Needs to be compatible with FastClick #21

Closed adam-lynch closed 8 years ago

adam-lynch commented 8 years ago

We have code like this project already and found we had to patch it because FastClick triggers clicks when the user taps. I'd like to move to depending on something like this (that's used & tested by many), rather than having our own custom code, but it would have to handle this case.

patrickhlauke commented 8 years ago

Have just tested what-input in combination with fastclick http://patrickhlauke.github.io/touch/what-input/index-fastclick.html and I don't see the two conflicting.That's likely due to the short delay used after touchstart was detected, which avoids seeing the mouse compatibility events and click you'd get in a regular touch interaction, as well as the click fired by scripts like fastclick.

Related: once iOS 9.3 lands, most mainstream browsers/platforms will have implemented optimisations to remove the 300ms delay, so unless you're targetting older platforms, fastclick and similar scripts will be superfluous. See http://patrickhlauke.github.io/touch/tests/results/#suppressing-300ms-delay

adam-lynch commented 8 years ago

Cool! I'll have to test it so sometime with our app :smile:.


Wait, all of those work on Android? :grinning:

ten1seven commented 8 years ago

@adam-lynch just tested this as well on a project I happen to be using both on and didn't see any issues on iOS 9.2.1/Safari. Sounds like I don't need to dig any deeper on this but could you explain the patch you had to implement for your script? Was it to fix iOS or Android?

adam-lynch commented 8 years ago

@ten1seven Android. It turned out to be also partly because of some of our code + hammerjs. See https://github.com/ftlabs/fastclick/issues/453#issuecomment-184771994

ten1seven commented 8 years ago

Ah, cool. Sounds like I can close this issue then. Please re-open or create a new issue if needed.

adam-lynch commented 8 years ago

Yep I'd say so. I'm sure plenty of people will test it on Android anyway :)

On Wed, Feb 17, 2016, 20:14 Jeremy Fields notifications@github.com wrote:

Ah, cool. Sounds like I can close this issue then. Please re-open or create a new issue if needed.

— Reply to this email directly or view it on GitHub https://github.com/ten1seven/what-input/issues/21#issuecomment-185383421 .

patrickhlauke commented 8 years ago

Yep I'd say so. I'm sure plenty of people will test it on Android anyway :)

note that i did test the combination of what-input and fastclick on Android as well as iOS, and both work just fine together (i did have a pretty stupid bug in my original demo, but i fixed that, and the results are still good) http://patrickhlauke.github.io/touch/what-input/index-fastclick.html

adam-lynch commented 8 years ago

Good to know, thanks @patrickhlauke :grinning: