Skip to content

Commit 4a601df

Browse files
committed
Added non-passive event listener to a scroll-blocking 'touchstart' event
Signed-off-by: TLT <tungluong2809@gmail.com>
1 parent 1a06f6c commit 4a601df

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/useDetectTouch.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ export default function useDetectTouch() {
1010
}
1111

1212
const removeListener = () => {
13-
document.removeEventListener('touchstart', handleTouch)
13+
document.removeEventListener('touchstart', handleTouch, { passive: true })
1414
}
1515

16-
document.addEventListener('touchstart', handleTouch)
16+
document.addEventListener('touchstart', handleTouch, { passive: true })
1717
return removeListener
1818
}, [])
1919

0 commit comments

Comments
 (0)