ngryman / jquery.finger

:v: jQuery touch & gestures, fingers in the nose.
https://ngryman.sh/jquery.finger/
MIT License
423 stars 66 forks source link

Prevent default `tap` not working in Firefox with touch #44

Closed jacobbuck closed 8 years ago

jacobbuck commented 8 years ago

The behaviour happening on Android, or when "Simulate touch events" is enabled.

Demo: http://jsfiddle.net/ys10otwe/

ngryman commented 8 years ago

Basically fingers prevents tap events in the native touchend event, which should avoid synthesizing a click event. It seems that Firefox is not behaving that way, not complying with other browsers behavior. I won't be able to fix this because the current implementation of finger does not allow me to prevent any behavior in the touchstart event using e.preventDefault().

But, there is a workaround, you could use the global preventDefault option which prevents default behavior in the touchstart native event:

$.Finger.preventDefault = true;
$('a').on('tap', function() {
  console.log("every finger's event prevents default behavior");
});

refs: