From 564571f4498be0dd28698026e7453b338d1d2a6f Mon Sep 17 00:00:00 2001 From: "mr. m" Date: Wed, 14 Jan 2026 19:27:21 +0100 Subject: [PATCH] fix: Fixed selecting split views with 2 windows turning them to blank tabs, b=no-bug, c=split-view, tabs --- prefs/zen/zen.yaml | 3 --- .../components/sessionstore/SessionStore-sys-mjs.patch | 4 ++-- src/zen/drag-and-drop/ZenDragAndDrop.js | 5 ++--- src/zen/sessionstore/ZenWindowSync.sys.mjs | 9 ++++++--- src/zen/split-view/ZenViewSplitter.mjs | 9 --------- src/zen/tabs/ZenEssentialsPromo.mjs | 3 --- src/zen/tabs/zen-essentials-promo.css | 4 +--- src/zen/tabs/zen-tabs/vertical-tabs.css | 4 ++++ 8 files changed, 15 insertions(+), 26 deletions(-) diff --git a/prefs/zen/zen.yaml b/prefs/zen/zen.yaml index 0b4366bd8..4dbcbd18d 100644 --- a/prefs/zen/zen.yaml +++ b/prefs/zen/zen.yaml @@ -14,9 +14,6 @@ - name: zen.tabs.essentials.max value: 12 -- name: zen.tabs.essentials.dnd-promo-enabled - value: true - - name: zen.tabs.show-newtab-vertical value: true diff --git a/src/browser/components/sessionstore/SessionStore-sys-mjs.patch b/src/browser/components/sessionstore/SessionStore-sys-mjs.patch index 18c77b523..1601aa22e 100644 --- a/src/browser/components/sessionstore/SessionStore-sys-mjs.patch +++ b/src/browser/components/sessionstore/SessionStore-sys-mjs.patch @@ -1,5 +1,5 @@ diff --git a/browser/components/sessionstore/SessionStore.sys.mjs b/browser/components/sessionstore/SessionStore.sys.mjs -index 2a055f0c5f34f0a2667f659185120c07d38f4e41..27f85dc47d66f2f83820e964198832d82bff04c1 100644 +index 2a055f0c5f34f0a2667f659185120c07d38f4e41..c0ab92bfc89306e4e7d3a43097beb2dc5c9189be 100644 --- a/browser/components/sessionstore/SessionStore.sys.mjs +++ b/browser/components/sessionstore/SessionStore.sys.mjs @@ -127,6 +127,9 @@ const TAB_EVENTS = [ @@ -219,8 +219,8 @@ index 2a055f0c5f34f0a2667f659185120c07d38f4e41..27f85dc47d66f2f83820e964198832d8 + aWindow.document.documentElement.setAttribute("zen-unsynced-window", "true"); + } + aWindow.gZenFolders?.restoreDataFromSessionStore(winData.folders); -+ aWindow.gZenViewSplitter?.restoreDataFromSessionStore(winData.splitViewData); + aWindow.gZenWorkspaces?.restoreWorkspacesFromSessionStore(winData); ++ aWindow.gZenViewSplitter?.restoreDataFromSessionStore(winData.splitViewData); // Move the originally open tabs to the end. if (initialTabs) { diff --git a/src/zen/drag-and-drop/ZenDragAndDrop.js b/src/zen/drag-and-drop/ZenDragAndDrop.js index c09a1a2ac..4959d047d 100644 --- a/src/zen/drag-and-drop/ZenDragAndDrop.js +++ b/src/zen/drag-and-drop/ZenDragAndDrop.js @@ -864,9 +864,8 @@ if (event.target.classList.contains("zen-workspace-empty-space")) { dropElement = this._tabbrowserTabs.ariaFocusableItems.at(-1); // Only if there are no normal tabs to drop after - showIndicatorUnderNewTabButton = !tabs.some( - (tab) => !(tab.group || tab).pinned || tab.hasAttribute("zen-essential") - ); + showIndicatorUnderNewTabButton = + gBrowser.tabs[gBrowser.tabs.length - 1].hasAttribute("zen-empty-tab"); } else { const numEssentials = gBrowser._numZenEssentials; const numPinned = gBrowser.pinnedTabCount - numEssentials; diff --git a/src/zen/sessionstore/ZenWindowSync.sys.mjs b/src/zen/sessionstore/ZenWindowSync.sys.mjs index bf894e13e..17b2e7e96 100644 --- a/src/zen/sessionstore/ZenWindowSync.sys.mjs +++ b/src/zen/sessionstore/ZenWindowSync.sys.mjs @@ -802,7 +802,11 @@ class nsZenWindowSync { if (aWindow.gBrowser.selectedTab === this.#lastSelectedTab && !ignoreSameTab) { return; } - if (aPreviousTab?._zenContentsVisible) { + let activeBrowsers = aWindow.gBrowser.selectedBrowsers; + let activeTabs = activeBrowsers.map((browser) => aWindow.gBrowser.getTabForBrowser(browser)); + // Ignore previous tabs that are still "active". These scenarios could happen for example, + // when selecting on a split view tab that was already active. + if (aPreviousTab?._zenContentsVisible && !activeTabs.includes(aPreviousTab)) { const otherTabToShow = this.#getActiveTabFromOtherWindows( aWindow, aPreviousTab.id, @@ -815,8 +819,7 @@ class nsZenWindowSync { } } let promises = []; - for (const browserView of aWindow.gBrowser.selectedBrowsers) { - const selectedTab = aWindow.gBrowser.getTabForBrowser(browserView); + for (const selectedTab of activeTabs) { if (selectedTab._zenContentsVisible || selectedTab.hasAttribute("zen-empty-tab")) { continue; } diff --git a/src/zen/split-view/ZenViewSplitter.mjs b/src/zen/split-view/ZenViewSplitter.mjs index ac23352ad..0eb28f7b7 100644 --- a/src/zen/split-view/ZenViewSplitter.mjs +++ b/src/zen/split-view/ZenViewSplitter.mjs @@ -2023,24 +2023,15 @@ class nsZenViewSplitter extends nsZenDOMOperatedFeature { return; } this._sessionRestoring = true; - let groups = []; // We can just get the tab group with document.getElementById(group.groupId) // and add the tabs to it for (const group of data) { const groupElement = document.getElementById(group.groupId); if (groupElement) { const tabs = groupElement.tabs; - groups.push(groupElement); this.splitTabs(tabs, group.gridType); } } - // See https://github.com/zen-browser/desktop/issues/11887, some groups - // may end up empty after restoring, so we need to remove them - for (const groupElement of groups) { - if (groupElement.tabs.length === 0) { - groupElement.remove(); - } - } delete this._sessionRestoring; } diff --git a/src/zen/tabs/ZenEssentialsPromo.mjs b/src/zen/tabs/ZenEssentialsPromo.mjs index 6e38d6642..a62d1481e 100644 --- a/src/zen/tabs/ZenEssentialsPromo.mjs +++ b/src/zen/tabs/ZenEssentialsPromo.mjs @@ -48,9 +48,6 @@ class nsZenEssentialsPromo extends MozXULElement { * "exists" if the promo already exists, or false if the section is not empty. */ export function createZenEssentialsPromo(container = undefined) { - if (!Services.prefs.getBoolPref("zen.tabs.essentials.dnd-promo-enabled", true)) { - return false; - } if (container === undefined) { container = gZenWorkspaces.getCurrentSpaceContainerId(); } diff --git a/src/zen/tabs/zen-essentials-promo.css b/src/zen/tabs/zen-essentials-promo.css index 48b5c4bb1..627e4214d 100644 --- a/src/zen/tabs/zen-essentials-promo.css +++ b/src/zen/tabs/zen-essentials-promo.css @@ -15,9 +15,7 @@ zen-essentials-promo { margin: 2px; text-align: center; box-shadow: 0 0 1px 1px rgba(0, 0, 0, 0.1); - transition: - background 0.1s, - outline 0.1s; + transition: background 0.1s; &:not([dragover="true"]) { background: color-mix(in srgb, var(--zen-primary-color) 60%, transparent); diff --git a/src/zen/tabs/zen-tabs/vertical-tabs.css b/src/zen/tabs/zen-tabs/vertical-tabs.css index d6f4ba1b1..78b8ed3cc 100644 --- a/src/zen/tabs/zen-tabs/vertical-tabs.css +++ b/src/zen/tabs/zen-tabs/vertical-tabs.css @@ -1349,4 +1349,8 @@ left: 0; pointer-events: none; background: var(--zen-primary-color); + + :root[zen-right-side="true"] & { + left: calc(-1 * var(--zen-toolbox-padding)); + } }