Skip to content

Commit f62f9f7

Browse files
committed
Do not set touchend listeners to passive
`touchend` listeners do not need to be passive to enable more performant scrolling. With this change, most of the tradeoffs with enabling `passiveTouchGestures` disappear, leaving only the inability to control scrolling from `track`, `down`, and `move` gestures. 1.x port of #4962
1 parent c6a29dc commit f62f9f7

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/standard/gestures.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@
349349
gobj[dep] = gd = {_count: 0};
350350
}
351351
if (gd._count === 0) {
352-
var options = !isMouseEvent(dep) && PASSIVE_TOUCH();
352+
var options = !isMouseEvent(dep) && dep !== 'touchend' && PASSIVE_TOUCH();
353353
node.addEventListener(dep, this.handleNative, options);
354354
}
355355
gd[name] = (gd[name] || 0) + 1;
@@ -377,7 +377,7 @@
377377
gd[name] = (gd[name] || 1) - 1;
378378
gd._count = (gd._count || 1) - 1;
379379
if (gd._count === 0) {
380-
var options = !isMouseEvent(dep) && PASSIVE_TOUCH();
380+
var options = !isMouseEvent(dep) && dep !== 'touchend' && PASSIVE_TOUCH();
381381
node.removeEventListener(dep, this.handleNative, options);
382382
}
383383
}

test/smoke/passive-gestures.html

+8-2
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,17 @@
4040
is: 'x-passive',
4141
listeners: {
4242
'down': 'prevent',
43-
'move': 'prevent'
43+
'move': 'prevent',
44+
'up': 'prevent',
45+
'tap': 'allowed',
46+
'click': 'allowed'
4447
},
4548
prevent: function(e) {
4649
e.preventDefault();
47-
console.log('prevented!');
50+
console.log('prevented?: ' + e.type + ' ' + e.defaultPrevented);
51+
},
52+
allowed: function(e) {
53+
console.log(e.type + ' allowed');
4854
}
4955
});
5056
</script>

0 commit comments

Comments
 (0)