From bab6a13bfbc00728ed41411d83aef9f1071786ff Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Wed, 11 Sep 2019 21:32:27 -0400 Subject: Fix nested popups being shown if parent is hidden --- ext/fg/js/popup-proxy-host.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ext/fg/js/popup-proxy-host.js b/ext/fg/js/popup-proxy-host.js index 041900ed..1f14a06f 100644 --- a/ext/fg/js/popup-proxy-host.js +++ b/ext/fg/js/popup-proxy-host.js @@ -116,12 +116,14 @@ class PopupProxyHost { async termsShow(id, elementRect, writingMode, definitions, options, context) { const popup = this.getPopup(id); elementRect = this.jsonRectToDOMRect(popup, elementRect); + if (!PopupProxyHost.popupCanShow(popup)) { return false; } return await popup.termsShow(elementRect, writingMode, definitions, options, context); } async kanjiShow(id, elementRect, writingMode, definitions, options, context) { const popup = this.getPopup(id); elementRect = this.jsonRectToDOMRect(popup, elementRect); + if (!PopupProxyHost.popupCanShow(popup)) { return false; } return await popup.kanjiShow(elementRect, writingMode, definitions, options, context); } @@ -129,6 +131,10 @@ class PopupProxyHost { const popup = this.getPopup(id); return popup.clearAutoPlayTimer(); } + + static popupCanShow(popup) { + return popup.parent === null || popup.parent.isVisible(); + } } PopupProxyHost.instance = PopupProxyHost.create(); -- cgit v1.2.3