ftlabs / fastclick

Polyfill to remove click delays on browsers with touch UIs
MIT License
18.66k stars 3.23k forks source link

Button that triggers click event on input is disabled after double tapping the screen - ios6 #156

Closed ghost closed 10 years ago

ghost commented 11 years ago

http://jsfiddle.net/wLJ6E/3/

  1. Run this demo on ios6
  2. Tap the click me button and it will show a file picker prompt
  3. Cancel the file prompt
  4. Now double tap anywhere quickly
  5. Tap the button, it won't trigger the file input
  6. Verified this bug occurs only with fastclick enabled

It looks like when you double tap, this.cancelNextClick is set to true: https://github.com/ftlabs/fastclick/blob/master/lib/fastclick.js#L486

But when clicking the button afterwards, it falls into this stopImmediatePropagation section and the event never happens: https://github.com/ftlabs/fastclick/blob/master/lib/fastclick.js#L602

this.cancelNextClick is never set to false and thus is stuck.

Seems like this also happens in this demo http://ftlabs.github.io/fastclick/examples/focus.html, when double tapping then tapping B, it never focuses the input.

mattcg commented 10 years ago

@blairvanderhoof, can you confirm the fix?

ghost commented 10 years ago

Confirmed works, tested on IO 7 before and after and it fixed it. Updated test case with new fastclick changes here: http://jsfiddle.net/wLJ6E/4/ Compare to old, broken version here: http://jsfiddle.net/wLJ6E/3

Thanks!