From d11fd0d5b4f6f60258d70396e49b304f3a802538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Boris=20Mazic=CC=81?= Date: Thu, 24 Jun 2021 16:02:21 +0200 Subject: [PATCH 1/2] make sure we mount the Popup to the relevant document.body in case of a new window created with window.open() --- src/modules/Popup/Popup.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/Popup/Popup.js b/src/modules/Popup/Popup.js index 49a0e638f5..5eae49c70f 100644 --- a/src/modules/Popup/Popup.js +++ b/src/modules/Popup/Popup.js @@ -271,6 +271,11 @@ export default class Popup extends Component { debug('popper modifiers:', modifiers) const referenceElement = createReferenceProxy(_.isNil(context) ? this.triggerRef : context) + // make sure we mount the Popup to the relevant document.body in case of a new window created with window.open() + const mountNodeProp = + referenceElement.ref && referenceElement.ref.current + ? { mountNode: referenceElement.ref.current.ownerDocument.body } + : {} const mergedPortalProps = { ...this.getPortalProps(), ...portalRestProps } debug('portal props:', mergedPortalProps) From 210667eb0bf356df3e13c88e6f8d45ea29a0f452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Boris=20Mazic=CC=81?= Date: Fri, 25 Jun 2021 10:31:46 +0200 Subject: [PATCH 2/2] added mountNodeProp to mergedPortalProps --- src/modules/Popup/Popup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/Popup/Popup.js b/src/modules/Popup/Popup.js index 5eae49c70f..cdeea7173d 100644 --- a/src/modules/Popup/Popup.js +++ b/src/modules/Popup/Popup.js @@ -277,7 +277,7 @@ export default class Popup extends Component { ? { mountNode: referenceElement.ref.current.ownerDocument.body } : {} - const mergedPortalProps = { ...this.getPortalProps(), ...portalRestProps } + const mergedPortalProps = { ...this.getPortalProps(), ...portalRestProps, ...mountNodeProp } debug('portal props:', mergedPortalProps) return (