From 5e20870c407b59f7614a3dc456769ee2767baf1a Mon Sep 17 00:00:00 2001 From: Rick Wargo Date: Tue, 13 Dec 2022 19:14:07 -0500 Subject: [PATCH] onWheel is a passive listener onWheel should be a passive listener so it does not significantly slow down scrolling. It also resolves issue #425 such that Chrome does not log a message to the console: ``` useTouchMove.js:154 [Violation] Added non-passive event listener to a scroll-blocking 'wheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952 ``` --- src/hooks/useTouchMove.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/useTouchMove.ts b/src/hooks/useTouchMove.ts index dcb126a2..5091d585 100644 --- a/src/hooks/useTouchMove.ts +++ b/src/hooks/useTouchMove.ts @@ -128,7 +128,7 @@ export default function useTouchMove( // No need to clean up since element removed ref.current.addEventListener('touchstart', onProxyTouchStart, { passive: false }); - ref.current.addEventListener('wheel', onProxyWheel); + ref.current.addEventListener('wheel', onProxyWheel, { passive: true }); return () => { document.removeEventListener('touchmove', onProxyTouchMove);