[Perf] Touch listeners should be passive

This commit is contained in:
Alexander Zinchuk 2021-08-23 03:38:23 +03:00
parent a76a7c3ac8
commit 18c88042e9

View File

@ -64,7 +64,7 @@ export function captureEvents(element: HTMLElement, options: CaptureOptions) {
// We need to always listen on `touchstart` target: // We need to always listen on `touchstart` target:
// https://stackoverflow.com/questions/33298828/touch-move-event-dont-fire-after-touch-start-target-is-removed // https://stackoverflow.com/questions/33298828/touch-move-event-dont-fire-after-touch-start-target-is-removed
const target = e.target as HTMLElement; const target = e.target as HTMLElement;
target.addEventListener('touchmove', onMove); target.addEventListener('touchmove', onMove, { passive: true });
target.addEventListener('touchend', onRelease); target.addEventListener('touchend', onRelease);
target.addEventListener('touchcancel', onRelease); target.addEventListener('touchcancel', onRelease);