mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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' ) {
|
||||
|
||||
Reference in New Issue
Block a user