Only trigger blur action when clicking either iframe or body

This commit is contained in:
Adria Navarro 2025-02-10 18:15:57 +01:00
parent 12ae35c16d
commit a64e0311d8
1 changed files with 8 additions and 3 deletions

View File

@ -93,9 +93,14 @@ const handleMouseDown = (e: MouseEvent) => {
// Handle iframe clicks by detecting a loss of focus on the main window
const handleBlur = () => {
handleClick(
new MouseEvent("click", { relatedTarget: document.activeElement })
)
if (
document.activeElement &&
["IFRAME", "BODY"].includes(document.activeElement.tagName)
) {
handleClick(
new MouseEvent("click", { relatedTarget: document.activeElement })
)
}
}
// Global singleton listeners for our events