From d106480f31527d86a6c46366e46740f0311495d3 Mon Sep 17 00:00:00 2001 From: Yuan <1076849402@qq.com> Date: Thu, 17 Dec 2020 14:45:42 +0800 Subject: [PATCH] fix: wheel handler set passive false List.js:248 [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 when use preventDefault in wheel event handler, should set passive false --- src/List.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/List.tsx b/src/List.tsx index 1521423..2b5f470 100644 --- a/src/List.tsx +++ b/src/List.tsx @@ -268,7 +268,9 @@ export function RawList(props: ListProps, ref: React.Ref) { } } - componentRef.current.addEventListener('wheel', onRawWheel); + componentRef.current.addEventListener('wheel', onRawWheel, { + passive: false, + }); componentRef.current.addEventListener('DOMMouseScroll', onFireFoxScroll as any); componentRef.current.addEventListener('MozMousePixelScroll', onMozMousePixelScroll);