From 6e1e1d061b66790aea5331ee65977e43ed329b0f Mon Sep 17 00:00:00 2001 From: "mr. m" Date: Sun, 8 Feb 2026 11:19:46 +0100 Subject: [PATCH] fix: Fixed clicking on the 'add' button not closing the panel, b=no-bug, c=common, workspaces --- src/zen/common/sys/ZenCustomizableUI.sys.mjs | 7 +++++-- src/zen/workspaces/ZenWorkspaces.mjs | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/zen/common/sys/ZenCustomizableUI.sys.mjs b/src/zen/common/sys/ZenCustomizableUI.sys.mjs index eef0b97a7..4adc45706 100644 --- a/src/zen/common/sys/ZenCustomizableUI.sys.mjs +++ b/src/zen/common/sys/ZenCustomizableUI.sys.mjs @@ -121,8 +121,11 @@ export const ZenCustomizableUI = new (class { #initCreateNewButton(window) { const button = window.document.getElementById("zen-create-new-button"); - button.addEventListener("command", (event) => { - if (window.gZenWorkspaces.privateWindowOrDisabled) { + // If we use "mousedown" event for private windows (which open a new tab on "click"), we might end up with + // the urlbar flicking and therefore we use "command" event to avoid that. + let isPrivateMode = window.gZenWorkspaces.privateWindowOrDisabled; + button.addEventListener(isPrivateMode ? "command" : "mousedown", (event) => { + if (isPrivateMode) { window.document.getElementById("cmd_newNavigatorTab").doCommand(); return; } diff --git a/src/zen/workspaces/ZenWorkspaces.mjs b/src/zen/workspaces/ZenWorkspaces.mjs index 37b77519e..b8fc667ef 100644 --- a/src/zen/workspaces/ZenWorkspaces.mjs +++ b/src/zen/workspaces/ZenWorkspaces.mjs @@ -2413,7 +2413,9 @@ class nsZenWorkspaces { containerTabId = parseInt(gBrowser.selectedTab.getAttribute("usercontextid")) || 0; let label = ContextualIdentityService.getUserContextLabel(containerTabId) || "Default"; name = this.isPrivateWindow ? "Incognito" : label; - icon = gZenEmojiPicker.getSVGURL("eye.svg"); + if (this.isPrivateWindow) { + icon = gZenEmojiPicker.getSVGURL("eye.svg"); + } } let workspace = { uuid: gZenUIManager.generateUuidv4(),