feat: Return to previous tab when closing tabs, p=#11933

* fix: Switch to last used tab on tab close

lastAccessed time will be used to select the active tab instead of positional selection or ownership when a tab is closed, returning the user to their last used tab.

* test: Merge branch and add tests, b=no-bug, c=common, tests, tabs, workspaces

---------

Co-authored-by: mr. m <91018726+mr-cheffy@users.noreply.github.com>
This commit is contained in:
Anodev-sudo
2026-01-17 06:18:43 -06:00
committed by GitHub
parent 7668c26ce5
commit ceb540536c
9 changed files with 134 additions and 44 deletions

View File

@@ -2819,9 +2819,8 @@ class nsZenWorkspaces {
const tabWorkspaceId = aTab.getAttribute("zen-workspace-id");
const containerId = aTab.getAttribute("usercontextid") ?? "0";
// Return all tabs that are not on the same workspace
return this.allStoredTabs.filter(
return gBrowser.tabs.filter(
(tab) =>
tab.getAttribute("zen-workspace-id") !== tabWorkspaceId &&
!this._shouldShowTab(tab, tabWorkspaceId, containerId, this._workspaceCache) &&
!tab.hasAttribute("zen-empty-tab")
);