Skip to content

Commit 50c6e21

Browse files
committed
Merge branch 'master' into remove-docgen
2 parents 43f3d40 + 304d039 commit 50c6e21

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/components/InfiniteScrollPaginator/InfiniteScroll.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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]);

src/components/InfiniteScrollPaginator/__tests__/InfiniteScroll.test.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff 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),

0 commit comments

Comments
 (0)