File tree Expand file tree Collapse file tree 2 files changed +8
-12
lines changed
src/components/InfiniteScrollPaginator Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -117,11 +117,11 @@ export const InfiniteScroll: React.FC<InfiniteScrollProps> = (props) => {
117117 useEffect ( ( ) => {
118118 const scrollElement = useWindow ? window : scrollComponent . current ?. parentNode ;
119119 if ( scrollElement ) {
120- scrollElement . addEventListener ( 'mousewheel ' , mousewheelListener , useCapture ) ;
120+ scrollElement . addEventListener ( 'wheel ' , mousewheelListener , { passive : false } ) ;
121121 }
122122 return ( ) => {
123123 if ( scrollElement ) {
124- scrollElement . removeEventListener ( 'mousewheel ' , mousewheelListener , useCapture ) ;
124+ scrollElement . removeEventListener ( 'wheel ' , mousewheelListener , useCapture ) ;
125125 }
126126 } ;
127127 } , [ useCapture , useWindow ] ) ;
Original file line number Diff line number Diff line change @@ -50,11 +50,9 @@ describe('InfiniteScroll', () => {
5050 const addEventListenerSpy = useWindow ? windowAddEventListenerSpy : divAddEventListenerSpy ;
5151
5252 expect ( addEventListenerSpy ) . toHaveBeenCalledWith ( 'scroll' , expect . any ( Function ) , useCapture ) ;
53- expect ( addEventListenerSpy ) . toHaveBeenCalledWith (
54- 'mousewheel' ,
55- expect . any ( Function ) ,
56- useCapture ,
57- ) ;
53+ expect ( addEventListenerSpy ) . toHaveBeenCalledWith ( 'wheel' , expect . any ( Function ) , {
54+ passive : false ,
55+ } ) ;
5856 expect ( addEventListenerSpy ) . toHaveBeenCalledWith ( 'resize' , expect . any ( Function ) , useCapture ) ;
5957 } ,
6058 ) ;
@@ -84,11 +82,9 @@ describe('InfiniteScroll', () => {
8482 expect . any ( Function ) ,
8583 useCapture ,
8684 ) ;
87- expect ( removeEventListenerSpy ) . toHaveBeenCalledWith (
88- 'mousewheel' ,
89- expect . any ( Function ) ,
90- useCapture ,
91- ) ;
85+ expect ( removeEventListenerSpy ) . toHaveBeenCalledWith ( 'wheel' , expect . any ( Function ) , {
86+ passive : false ,
87+ } ) ;
9288 expect ( removeEventListenerSpy ) . toHaveBeenCalledWith (
9389 'resize' ,
9490 expect . any ( Function ) ,
You can’t perform that action at this time.
0 commit comments