Skip to content

Commit

Permalink
fix(onClickOutside): ensure focus on iframe captured in firefox (#3066)
Browse files Browse the repository at this point in the history
  • Loading branch information
Geit committed May 5, 2023
1 parent 3233af2 commit 2c66ef5
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/core/onClickOutside/index.ts
Expand Up @@ -93,12 +93,14 @@ export function onClickOutside<T extends OnClickOutsideOptions>(
shouldListen = !e.composedPath().includes(el) && !shouldIgnore(e)
}, { passive: true }),
detectIframe && useEventListener(window, 'blur', (event) => {
const el = unrefElement(target)
if (
window.document.activeElement?.tagName === 'IFRAME'
&& !el?.contains(window.document.activeElement)
)
handler(event as any)
setTimeout(() => {
const el = unrefElement(target)
if (
window.document.activeElement?.tagName === 'IFRAME'
&& !el?.contains(window.document.activeElement)
)
handler(event as any)
}, 0)
}),
].filter(Boolean) as Fn[]

Expand Down

0 comments on commit 2c66ef5

Please sign in to comment.