Skip to content

Commit 772459d

Browse files
author
Adam Bradley
committed
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
1 parent f5bb023 commit 772459d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

js/utils/gestures.js

-1
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,6 @@
10891089

10901090
// do a single tap
10911091
if(!did_doubletap || inst.options.tap_always) {
1092-
ionic.tap.cancelClick();
10931092
ionic.Gestures.detection.current.name = 'tap';
10941093
inst.trigger('tap', ev);
10951094
}

js/utils/tap.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ ionic.tap = {
155155
(e.target.isContentEditable) ||
156156
(/^(file|range)$/i).test(e.target.type) ||
157157
(e.target.dataset ? e.target.dataset.preventScroll : e.target.getAttribute('data-prevent-default')) == 'true' || // manually set within an elements attributes
158-
(!!(/^(object|embed)$/i).test(e.target.tagName)); // flash/movie/object touches should not try to scroll
158+
(!!(/^(object|embed)$/i).test(e.target.tagName)) || // flash/movie/object touches should not try to scroll
159+
ionic.tap.isElementTapDisabled(e.target); // check if this element, or an ancestor, has `data-tap-disabled` attribute
159160
},
160161

161162
isTextInput: function(ele) {
@@ -224,7 +225,11 @@ ionic.tap = {
224225
if(!ele || ele.disabled || (/^(file|range)$/i).test(ele.type) || (/^(object|video)$/i).test(ele.tagName) ) {
225226
return true;
226227
}
227-
if(ele.nodeType === 1) {
228+
return ionic.tap.isElementTapDisabled(ele);
229+
},
230+
231+
isElementTapDisabled: function(ele) {
232+
if(ele && ele.nodeType === 1) {
228233
var element = ele;
229234
while(element) {
230235
if( (element.dataset ? element.dataset.tapDisabled : element.getAttribute('data-tap-disabled')) == 'true' ) {

0 commit comments

Comments
 (0)