feat: no-bug - Improved tab blur next selection, r=workspaces

This commit is contained in:
mr. m 2025-04-16 12:50:21 +02:00
parent 0b467cc149
commit dd005b31a4
No known key found for this signature in database
GPG key ID: 419302196C23B258
2 changed files with 11 additions and 4 deletions

View file

@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
index 5f406ea5d09273c9b70b84eee24c6267f88692f8..c4fa57b30e48c9364bf252e7f1f62ae9c6fa3b40 100644
index 5f406ea5d09273c9b70b84eee24c6267f88692f8..22d077e528387a6fbe59a170784dd8caa0c65b26 100644
--- a/browser/components/tabbrowser/content/tabbrowser.js
+++ b/browser/components/tabbrowser/content/tabbrowser.js
@@ -424,11 +424,67 @@
@ -565,7 +565,7 @@ index 5f406ea5d09273c9b70b84eee24c6267f88692f8..c4fa57b30e48c9364bf252e7f1f62ae9
if (unloadBlocked) {
return;
}
@@ -5159,7 +5324,7 @@
@@ -5159,13 +5324,13 @@
!excludeTabs.has(aTab.owner) &&
Services.prefs.getBoolPref("browser.tabs.selectOwnerOnClose")
) {
@ -574,6 +574,13 @@ index 5f406ea5d09273c9b70b84eee24c6267f88692f8..c4fa57b30e48c9364bf252e7f1f62ae9
}
// Try to find a remaining tab that comes after the given tab
let remainingTabs = Array.prototype.filter.call(
this.visibleTabs,
- tab => !excludeTabs.has(tab)
+ tab => !excludeTabs.has(tab) && ZenWorkspaces._shouldChangeToTab(tab)
);
let tab = this.tabContainer.findNextTab(aTab, {
@@ -5181,7 +5346,7 @@
}

View file

@ -1813,7 +1813,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}
_shouldChangeToTab(aTab) {
return !(aTab.hasAttribute('zen-essential') || (aTab.pinned && aTab.hasAttribute('pending')));
return !(aTab?.hasAttribute('zen-essential') || (aTab?.pinned && aTab?.hasAttribute('pending')));
}
async _handleTabSelection(window, onInit, containerId, workspaces, previousWorkspaceId, prevTabUsed) {
@ -2182,7 +2182,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}
findTabToBlur(tab) {
if (!this._shouldChangeToTab(tab) && this._emptyTab) {
if ((!this._shouldChangeToTab(tab) || !tab) && this._emptyTab) {
return this._emptyTab;
}
return tab;