aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/fg/js/popup.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js
index e735431b..00658f58 100644
--- a/ext/fg/js/popup.js
+++ b/ext/fg/js/popup.js
@@ -281,7 +281,7 @@ class Popup {
}
_onFullscreenChanged() {
- const parent = (DOM.getFullscreenElement() || document.body || null);
+ const parent = this._getFrameParentElement();
if (parent !== null && this._container.parentNode !== parent) {
parent.appendChild(this._container);
}
@@ -375,6 +375,22 @@ class Popup {
contentWindow.postMessage({action, params, token}, this._targetOrigin);
}
+ _getFrameParentElement() {
+ const defaultParent = document.body;
+ const fullscreenElement = DOM.getFullscreenElement();
+ if (fullscreenElement === null || fullscreenElement.shadowRoot) {
+ return defaultParent;
+ }
+
+ switch (fullscreenElement.nodeName.toUpperCase()) {
+ case 'IFRAME':
+ case 'FRAME':
+ return defaultParent;
+ }
+
+ return fullscreenElement;
+ }
+
static _getPositionForHorizontalText(elementRect, width, height, viewport, offsetScale, optionsGeneral) {
const preferBelow = (optionsGeneral.popupHorizontalTextPosition === 'below');
const horizontalOffset = optionsGeneral.popupHorizontalOffset * offsetScale;