From d0d78d29532f99a18b8835e73e97ca59a59e61b6 Mon Sep 17 00:00:00 2001 From: "Mr. M" Date: Sun, 18 May 2025 18:33:12 +0200 Subject: [PATCH] fix: Fixed marking the scroll indicator for workspace periferies, b=(no-bug), c=workspaces --- src/zen/workspaces/ZenWorkspace.mjs | 30 +++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/zen/workspaces/ZenWorkspace.mjs b/src/zen/workspaces/ZenWorkspace.mjs index 28bdf63e..22defe25 100644 --- a/src/zen/workspaces/ZenWorkspace.mjs +++ b/src/zen/workspaces/ZenWorkspace.mjs @@ -55,13 +55,31 @@ ); this.scrollbox._getScrollableElements = () => { - return gBrowser.tabContainer.ariaFocusableItems.filter(this.scrollbox._canScrollToElement); - }; - this.scrollbox._canScrollToElement = (element) => { - if (gBrowser.isTab(element)) { - return !element.hasAttribute('zen-essential') && !this.hasAttribute('positionpinnedtabs'); + const children = [...this.pinnedTabsContainer.children, ...this.tabsContainer.children]; + if (Services.prefs.getBoolPref('zen.view.show-newtab-button-top', false)) { + // Move the perifery to the first non-pinned tab + const periphery = this.tabsContainer.querySelector( + '#tabbrowser-arrowscrollbox-periphery' + ); + if (periphery) { + const firstNonPinnedTabIndex = children.findIndex( + (child) => gBrowser.isTab(child) && !child.pinned + ); + if (firstNonPinnedTabIndex > -1) { + // Change to new location and remove from the old one on the list + const peripheryIndex = children.indexOf(periphery); + if (peripheryIndex > -1) { + children.splice(peripheryIndex, 1); + } + children.splice(firstNonPinnedTabIndex, 0, periphery); + } + } } - return true; + return Array.prototype.filter.call( + children, + this.scrollbox._canScrollToElement, + this.scrollbox + ); }; // Override for performance reasons. This is the size of a single element