aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js
diff options
context:
space:
mode:
authorAlex Yatskov <FooSoft@users.noreply.github.com>2019-09-14 17:29:52 -0700
committerGitHub <noreply@github.com>2019-09-14 17:29:52 -0700
commitab2db771adc9f3d45dfe537299f473b391fc85e9 (patch)
tree6c3c05aca7f286fd93f6fd736e706c5f14811ed1 /ext/fg/js
parentec816e676771b53f6eb2c9c68e1742830c9fd194 (diff)
parentbab6a13bfbc00728ed41411d83aef9f1071786ff (diff)
Merge pull request #208 from toasted-nutbread/fix-popup-orphans
Fix nested popups being shown if parent is hidden
Diffstat (limited to 'ext/fg/js')
-rw-r--r--ext/fg/js/popup-proxy-host.js6
1 files changed, 6 insertions, 0 deletions
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();