Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1c60c68

Browse filesBrowse files
authored
fix(onClickOutside): workaround for iOS (#4735)
1 parent a16bfb0 commit 1c60c68
Copy full SHA for 1c60c68

File tree

1 file changed

+4
-2
lines changed
Filter options

1 file changed

+4
-2
lines changed

‎packages/core/onClickOutside/index.ts

Copy file name to clipboardExpand all lines: packages/core/onClickOutside/index.ts
+4-2
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ export function onClickOutside(
8484
if (isIOS && !_iOSWorkaround) {
8585
_iOSWorkaround = true
8686
const listenerOptions = { passive: true }
87+
// Not using useEventListener because this event handlers must not be disposed.
88+
// See previusly linked references and https://github.com/vueuse/vueuse/issues/4724
8789
Array.from(window.document.body.children)
88-
.forEach(el => useEventListener(el, 'click', noop, listenerOptions))
89-
useEventListener(window.document.documentElement, 'click', noop, listenerOptions)
90+
.forEach(el => el.addEventListener('click', noop, listenerOptions))
91+
window.document.documentElement.addEventListener('click', noop, listenerOptions)
9092
}
9193

9294
let shouldListen = true

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.