From 772459df1e600cda63a59dc0dd79fe5c28982e56 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Tue, 10 Jun 2014 10:18:18 -0500 Subject: [PATCH] fix(tap): ignoreScrollStart w/ data-tap-disabled If an element, or one of its ancestors, has the `data-tap-disabled` attribute, then it should not start the scroll. Closes #1505 --- js/utils/gestures.js | 1 - js/utils/tap.js | 9 +++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/js/utils/gestures.js b/js/utils/gestures.js index 65e61f31fc1..ab921e3d202 100644 --- a/js/utils/gestures.js +++ b/js/utils/gestures.js @@ -1089,7 +1089,6 @@ // do a single tap if(!did_doubletap || inst.options.tap_always) { - ionic.tap.cancelClick(); ionic.Gestures.detection.current.name = 'tap'; inst.trigger('tap', ev); } diff --git a/js/utils/tap.js b/js/utils/tap.js index a6eaf1a295a..c64f886bc8c 100644 --- a/js/utils/tap.js +++ b/js/utils/tap.js @@ -155,7 +155,8 @@ ionic.tap = { (e.target.isContentEditable) || (/^(file|range)$/i).test(e.target.type) || (e.target.dataset ? e.target.dataset.preventScroll : e.target.getAttribute('data-prevent-default')) == 'true' || // manually set within an elements attributes - (!!(/^(object|embed)$/i).test(e.target.tagName)); // flash/movie/object touches should not try to scroll + (!!(/^(object|embed)$/i).test(e.target.tagName)) || // flash/movie/object touches should not try to scroll + ionic.tap.isElementTapDisabled(e.target); // check if this element, or an ancestor, has `data-tap-disabled` attribute }, isTextInput: function(ele) { @@ -224,7 +225,11 @@ ionic.tap = { if(!ele || ele.disabled || (/^(file|range)$/i).test(ele.type) || (/^(object|video)$/i).test(ele.tagName) ) { return true; } - if(ele.nodeType === 1) { + return ionic.tap.isElementTapDisabled(ele); + }, + + isElementTapDisabled: function(ele) { + if(ele && ele.nodeType === 1) { var element = ele; while(element) { if( (element.dataset ? element.dataset.tapDisabled : element.getAttribute('data-tap-disabled')) == 'true' ) {