gh-12112: auto-focus URL bar when replace-newtab is disabled (gh-13080)

Co-authored-by: mr. m <mr.m@tuta.com>
This commit is contained in:
Chris McLaughlin
2026-04-04 12:54:13 -05:00
committed by GitHub
parent 6ffeecad3a
commit bbaf7279ed

View File

@@ -875,10 +875,12 @@ class nsZenWorkspaces {
};
let removedEmptyTab = false;
let initialTabWasEmpty = false;
if (
this._initialTab &&
!(this._initialTab._shouldRemove && this._initialTab._veryPossiblyEmpty)
) {
initialTabWasEmpty = !!this._initialTab._veryPossiblyEmpty;
gBrowser.selectedTab = this._initialTab;
this.moveTabToWorkspace(this._initialTab, this.activeWorkspace);
gBrowser.moveTabTo(this._initialTab, {
@@ -943,7 +945,12 @@ class nsZenWorkspaces {
delete this._initialTab;
}
showed &&= Services.prefs.getBoolPref("zen.urlbar.open-on-startup", true);
const openOnStartup = Services.prefs.getBoolPref(
"zen.urlbar.open-on-startup",
true
);
showed &&= openOnStartup;
initialTabWasEmpty &&= openOnStartup;
// Wait for the next event loop to ensure that the startup focus logic by
// firefox has finished doing it's thing.
@@ -951,7 +958,9 @@ class nsZenWorkspaces {
setTimeout(() => {
if (gZenVerticalTabsManager._canReplaceNewTab && showed) {
BrowserCommands.openTab();
} else if (!showed) {
} else if (showed || initialTabWasEmpty) {
openLocation();
} else {
gBrowser.selectedBrowser.focus();
}
});