From 1176f5ac8b04953d07cf254be7716b27b3a6fcc8 Mon Sep 17 00:00:00 2001 From: "mr. m" Date: Wed, 28 Jan 2026 12:12:52 +0100 Subject: [PATCH] fix: Fixed auto focus not working on popup windows, b=closes #11377, c=common, workspaces --- src/zen/common/modules/ZenStartup.mjs | 6 ------ src/zen/workspaces/ZenWorkspaces.mjs | 16 +++++++++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/zen/common/modules/ZenStartup.mjs b/src/zen/common/modules/ZenStartup.mjs index 517398862..1de5d9027 100644 --- a/src/zen/common/modules/ZenStartup.mjs +++ b/src/zen/common/modules/ZenStartup.mjs @@ -87,7 +87,6 @@ class ZenStartup { await delayedStartupPromise; await SessionStore.promiseAllWindowsRestored; delete gZenUIManager.promiseInitialized; - this.#initSearchBar(); gZenCompactModeManager.init(); // Fix for https://github.com/zen-browser/desktop/issues/7605, specially in compact mode if (gURLBar.hasAttribute("breakout-extend")) { @@ -154,11 +153,6 @@ class ZenStartup { } } - #initSearchBar() { - // Only focus the url bar - gURLBar.focus(); - } - #checkForWelcomePage() { if (!Services.prefs.getBoolPref("zen.welcome-screen.seen", false)) { Services.prefs.setBoolPref("zen.welcome-screen.seen", true); diff --git a/src/zen/workspaces/ZenWorkspaces.mjs b/src/zen/workspaces/ZenWorkspaces.mjs index 84727cdfb..b679f7328 100644 --- a/src/zen/workspaces/ZenWorkspaces.mjs +++ b/src/zen/workspaces/ZenWorkspaces.mjs @@ -1044,11 +1044,17 @@ class nsZenWorkspaces { delete this._initialTab; } - if (gZenVerticalTabsManager._canReplaceNewTab && showed) { - BrowserCommands.openTab(); - } else if (!showed) { - gBrowser.selectedBrowser.focus(); - } + // Wait for the next event loop to ensure that the startup focus logic by + // firefox has finished doing it's thing. + setTimeout(() => { + setTimeout(() => { + if (gZenVerticalTabsManager._canReplaceNewTab && showed) { + BrowserCommands.openTab(); + } else if (!showed) { + gBrowser.selectedBrowser.focus(); + } + }); + }); if ( !gZenVerticalTabsManager._canReplaceNewTab &&