From 78510099add6d65a925c497ab9303560474a1807 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Wed, 2 Apr 2014 10:07:45 -0500 Subject: [PATCH] fix(tap): Do not simulate a click if it was from a touchcanel event, closes #1015 --- js/utils/gestures.js | 2 +- js/utils/tap.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/js/utils/gestures.js b/js/utils/gestures.js index ea77e3a179..0ed1ef442a 100644 --- a/js/utils/gestures.js +++ b/js/utils/gestures.js @@ -1066,7 +1066,7 @@ doubletap_interval : 300 }, handler: function tapGesture(ev, inst) { - if(ev.eventType == ionic.Gestures.EVENT_END) { + if(ev.eventType == ionic.Gestures.EVENT_END && ev.srcEvent.type != 'touchcancel') { // previous gesture, for the double tap since these are two different gesture detections var prev = ionic.Gestures.detection.previous, did_doubletap = false; diff --git a/js/utils/tap.js b/js/utils/tap.js index 109f8419d8..dea63a6cf6 100644 --- a/js/utils/tap.js +++ b/js/utils/tap.js @@ -47,9 +47,10 @@ var e = orgEvent.gesture.srcEvent; // evaluate the actual source event, not the created event by gestures.js var ele = e.target; - if( isRecentTap(e) ) { - // if a tap in the same area just happened, don't continue - console.debug('tapPolyfill', 'isRecentTap', ele.tagName); + if( isRecentTap(e) || e.type === 'touchcancel' ) { + // if a tap in the same area just happened, + // or it was a touchcanel event, don't continue + console.debug('tapPolyfill', 'isRecentTap', ele.tagName, 'type:', e.type); return stopEvent(e); }