From f5f475f7382adda3fddf4f3d1a2e8d1f16ce57ce Mon Sep 17 00:00:00 2001 From: windingwind <33902321+windingwind@users.noreply.github.com> Date: Sat, 16 Dec 2023 19:18:03 +0800 Subject: [PATCH] Fix closing and reopening a *native* menu too quickly causes it to be closed again --- chrome/content/zotero/customElements.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/customElements.js b/chrome/content/zotero/customElements.js index 8f6b15aa1a..c11bfe7747 100644 --- a/chrome/content/zotero/customElements.js +++ b/chrome/content/zotero/customElements.js @@ -102,7 +102,11 @@ Services.scriptloader.loadSubScript('chrome://zotero/content/elements/annotation // Update animate attribute when the popup is hiding and trigger the fade out animation this.addEventListener("popuphiding", (e) => { - if (!this.getAttribute("animate") || ["false", "false-once"].includes(this.getAttribute("animate"))) { + if ( + // open="true" and aria-hidden="true" means it's a native menupopup + (this.getAttribute("open", "true") && this.getAttribute("aria-hidden", "true")) + || !this.getAttribute("animate") + || ["false", "false-once"].includes(this.getAttribute("animate"))) { return; } e.preventDefault();