Skip to content

Commit fc24f8d

Browse files
committed
Core: Touch - use "capture" for touchstart events
1 parent c9a3d6c commit fc24f8d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/core/modules/touch/touch.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,16 +350,18 @@ function initTouch() {
350350

351351

352352
const passiveListener = Support.passiveListener ? { passive: true } : false;
353+
const passiveListenerCapture = Support.passiveListener ? { passive: true, capture: true } : true;
353354
const activeListener = Support.passiveListener ? { passive: false } : false;
355+
const activeListenerCapture = Support.passiveListener ? { passive: false, capture: true } : true;
354356

355357
document.addEventListener('click', appClick, true);
356358

357359
if (Support.passiveListener) {
358-
document.addEventListener(app.touchEvents.start, appTouchStartActive, activeListener);
360+
document.addEventListener(app.touchEvents.start, appTouchStartActive, activeListenerCapture);
359361
document.addEventListener(app.touchEvents.move, appTouchMoveActive, activeListener);
360362
document.addEventListener(app.touchEvents.end, appTouchEndActive, activeListener);
361363

362-
document.addEventListener(app.touchEvents.start, appTouchStartPassive, passiveListener);
364+
document.addEventListener(app.touchEvents.start, appTouchStartPassive, passiveListenerCapture);
363365
document.addEventListener(app.touchEvents.move, appTouchMovePassive, passiveListener);
364366
document.addEventListener(app.touchEvents.end, appTouchEndPassive, passiveListener);
365367
if (Support.touch && Support.gestures) {
@@ -375,7 +377,7 @@ function initTouch() {
375377
document.addEventListener(app.touchEvents.start, (e) => {
376378
appTouchStartActive(e);
377379
appTouchStartPassive(e);
378-
}, false);
380+
}, true);
379381
document.addEventListener(app.touchEvents.move, (e) => {
380382
appTouchMoveActive(e);
381383
appTouchMovePassive(e);

0 commit comments

Comments
 (0)