This commit is contained in:
mr. m
2025-10-20 12:36:52 +02:00
3 changed files with 44 additions and 30 deletions

View File

@@ -1,5 +1,5 @@
diff --git a/toolkit/content/widgets/tabbox.js b/toolkit/content/widgets/tabbox.js
index 70afbfc87d543971e6f8a0661a44b682920a7bc4..2f767296db8043318fab2aeb39bfc5eee090b258 100644
index 70afbfc87d543971e6f8a0661a44b682920a7bc4..2035222f4680e2eaa27b3072a12a9163b914adec 100644
--- a/toolkit/content/widgets/tabbox.js
+++ b/toolkit/content/widgets/tabbox.js
@@ -213,7 +213,7 @@
@@ -20,7 +20,15 @@ index 70afbfc87d543971e6f8a0661a44b682920a7bc4..2f767296db8043318fab2aeb39bfc5ee
if (otherTab != tab && otherTab.selected) {
otherTab._selected = false;
}
@@ -823,7 +823,7 @@
@@ -646,6 +646,7 @@
* @param {MozTab|null} [val]
*/
set selectedItem(val) {
+ val = window.gZenGlanceManager?.getTabOrGlanceChild(val) || val;
if (val && !val.selected) {
// The selectedIndex setter ignores invalid values
// such as -1 if |val| isn't one of our child nodes.
@@ -823,7 +824,7 @@
if (tab == startTab) {
return null;
}
@@ -29,7 +37,11 @@ index 70afbfc87d543971e6f8a0661a44b682920a7bc4..2f767296db8043318fab2aeb39bfc5ee
return tab;
}
}
@@ -888,7 +888,7 @@
@@ -885,10 +886,11 @@
* @param {boolean} [aWrap]
*/
advanceSelectedTab(aDir, aWrap) {
+ if (window?.gZenGlanceManager?._animating) return;
let { ariaFocusedItem } = this;
let startTab = ariaFocusedItem;
if (!ariaFocusedItem || !this.allTabs.includes(ariaFocusedItem)) {

View File

@@ -774,7 +774,7 @@
(this._animating && !onTabClose) ||
!this.#currentBrowser ||
(this.animatingOpen && !onTabClose) ||
this._duringOpening
this.#duringOpening
);
}
@@ -1055,7 +1055,7 @@
this.#currentParentTab.removeAttribute('glance-id');
this.#glances.delete(this.#currentGlanceID);
this.#currentGlanceID = setNewID;
this._duringOpening = false;
this.#duringOpening = false;
}
/**
@@ -1067,8 +1067,11 @@
}
this.#duringOpening = true;
this.#configureGlanceElements();
// IMPORTANT: #setGlanceStates() must be called before #configureGlanceElements()
// to ensure that the glance state is fully set up before configuring the DOM elements.
// This order is required to avoid timing/state issues. Do not reorder without understanding the dependencies.
this.#setGlanceStates();
this.#configureGlanceElements();
this.#duringOpening = false;
}
@@ -1184,10 +1187,17 @@
/**
* Open glance on location change if not animating
* @param {Tab} prevTab - The previous tab
*/
onLocationChangeOpenGlance() {
#onLocationChangeOpenGlance(prevTab) {
if (!this.animatingOpen) {
this.quickOpenGlance();
if (prevTab && prevTab.linkedBrowser) {
prevTab.linkedBrowser.docShellIsActive = false;
prevTab.linkedBrowser
.closest('.browserSidebarContainer')
.classList.remove('deck-selected');
}
}
}
@@ -1198,6 +1208,7 @@
*/
onLocationChange(event) {
const tab = event.target;
const prevTab = event.detail.previousTab;
if (this.animatingFullOpen || this.closingGlance) {
return;
@@ -1215,30 +1226,11 @@
}
this.#currentGlanceID = tab.getAttribute('glance-id');
if (gBrowser.selectedTab === this.#currentParentTab && this.#currentBrowser) {
this.#handleParentTabSelection(event);
} else if (gBrowser.selectedTab === this.#currentTab) {
setTimeout(this.onLocationChangeOpenGlance.bind(this), 0);
if (gBrowser.selectedTab === this.#currentTab) {
this.#onLocationChangeOpenGlance(prevTab);
return;
}
}
/**
* Handle parent tab selection
* @param {Event} event - The location change event
*/
#handleParentTabSelection(event) {
const curTab = this.#currentTab;
const prevTab = event.detail.previousTab;
setTimeout(() => {
gBrowser.selectedTab = curTab;
if (prevTab?.linkedBrowser) {
prevTab.linkedBrowser
.closest('.browserSidebarContainer')
.classList.remove('deck-selected');
}
}, 0);
this.#currentGlanceID = null;
}
/**
@@ -1607,6 +1599,15 @@
return tab;
}
/**
* Get the tab or its glance child
* @param {Tab} tab - The tab to check
* @returns {Tab} The tab or its child
*/
getTabOrGlanceChild(tab) {
return tab?.glanceTab || tab;
}
/**
* Check if deck should remain selected
* @param {Element} currentPanel - Current panel

View File

@@ -867,6 +867,7 @@
}
}, 3000);
});
return;
}
const isSpltView = tab.group?.hasAttribute('split-view-group');
const group = isSpltView ? tab.group.group : tab.group;