-
Notifications
You must be signed in to change notification settings - Fork 28
Closed
Description
Describe the bug
My app crashes with JS error:
Failed to read a named property 'event' from 'Window': Blocked a frame with origin "http://localhost:8080" from accessing a cross-origin frame.
To Reproduce
Steps to reproduce the behavior:
- Use react-bootstrap with
<DroprownMenu>
component - Use the app in
iframe
- Open dropdown menu
Expected behavior
No exception.
Environment (please complete the following information)
- react-overlays: 5.2.1
Additional context
I work around this issue by using patch-package
module with the following patch:
diff --git a/node_modules/@restart/ui/esm/useClickOutside.js b/node_modules/@restart/ui/esm/useClickOutside.js
index 7c8eeb3..63d1db2 100644
--- a/node_modules/@restart/ui/esm/useClickOutside.js
+++ b/node_modules/@restart/ui/esm/useClickOutside.js
@@ -66,7 +66,7 @@ function useClickOutside(ref, onClickOutside = noop, {
// For things rendered in an iframe, the event might originate on the parent window
// so we should fall back to that global event if the local one doesn't exist
// https://github.com/facebook/react/issues/20074
- let currentEvent = (_ownerWindow$event = ownerWindow.event) != null ? _ownerWindow$event : (_ownerWindow$parent = ownerWindow.parent) == null ? void 0 : _ownerWindow$parent.event;
+ let currentEvent = null; try { currentEvent = (_ownerWindow$event = ownerWindow.event) != null ? _ownerWindow$event : (_ownerWindow$parent = ownerWindow.parent) == null ? void 0 : _ownerWindow$parent.event; } catch {}
let removeInitialTriggerListener = null;
if (InitialTriggerEvents[clickTrigger]) {
removeInitialTriggerListener = listen(doc, InitialTriggerEvents[clickTrigger], handleInitialMouse, true);
Metadata
Metadata
Assignees
Labels
No labels