From 45b9cfe37f5c024b6eeb65274d80bf42a1340c65 Mon Sep 17 00:00:00 2001 From: Andrey Bochkarev <50177704+octaviusz@users.noreply.github.com> Date: Thu, 17 Sep 2026 15:54:22 +0300 Subject: [PATCH] gh-15419: Fix overflow-extension order in single toolbar mode (gh-15420) --- src/zen/common/modules/ZenUIManager.mjs | 27 +++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/zen/common/modules/ZenUIManager.mjs b/src/zen/common/modules/ZenUIManager.mjs index 98ba56e20..a6ebe1bd9 100644 --- a/src/zen/common/modules/ZenUIManager.mjs +++ b/src/zen/common/modules/ZenUIManager.mjs @@ -1404,18 +1404,37 @@ window.gZenVerticalTabsManager = { if (isSingleToolbar) { this._navbarParent = navBar.parentElement; - let elements = document.querySelectorAll( - '#nav-bar-customization-target > :is([cui-areatype="toolbar"], .chromeclass-toolbar-additional):not(#urlbar-container):not(toolbarspring)' + let elements = Array.from( + document.querySelectorAll( + '#nav-bar-customization-target > :is([cui-areatype="toolbar"], .chromeclass-toolbar-additional):not(#urlbar-container):not(toolbarspring)' + ) ); - elements = Array.from(elements).reverse(); + let normalButtons = []; + let extensionButtons = []; + for (const element of elements) { + if ( + element.hasAttribute("data-extensionid") && + Services.prefs.getBoolPref("zen.view.overflow-webext-toolbar", true) + ) { + extensionButtons.push(element); + } else { + normalButtons.push(element); + } + } // Add separator if it doesn't exist if (!this._hasSetSingleToolbar) { buttonsTarget.append(this._topButtonsSeparatorElement); } this._hasSetSingleToolbar = true; - for (const button of elements) { + for (const button of normalButtons.reverse()) { this.appendCustomizableItem(this._topButtonsSeparatorElement, button); } + for (const extension of extensionButtons) { + this.appendCustomizableItem( + this._topButtonsSeparatorElement, + extension + ); + } buttonsTarget.prepend( document.getElementById("unified-extensions-button") );