Skip to content

Commit 9289e56

Browse files
committed
Make handleDocumentEvent listeners passive
1 parent 2331f7d commit 9289e56

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

components/dropdown.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,17 +128,17 @@ export const Dropdown = memo(props => {
128128
useEffect(() => {
129129
if (isOpen) {
130130
['click', 'touchstart'].forEach(evType =>
131-
document.addEventListener(evType, handleDocumentEvent, true)
131+
document.addEventListener(evType, handleDocumentEvent, { passive: true, capture: true })
132132
);
133133
} else {
134134
['click', 'touchstart', 'keyup'].forEach(evType =>
135-
document.removeEventListener(evType, handleDocumentEvent, true)
135+
document.removeEventListener(evType, handleDocumentEvent, { capture: true })
136136
);
137137
}
138138

139139
return () => {
140140
['click', 'touchstart', 'keyup'].forEach(evType =>
141-
document.removeEventListener(evType, handleDocumentEvent, true)
141+
document.removeEventListener(evType, handleDocumentEvent, { capture: true })
142142
);
143143
}
144144

0 commit comments

Comments
 (0)