feat: Improved tab switching for containerizedd essentials, b=(no-bug), c=common, workspaces

This commit is contained in:
Mr. M
2025-04-25 00:17:54 +02:00
parent cad9a299c3
commit 8fcf251916
2 changed files with 10 additions and 5 deletions

View File

@@ -70,9 +70,12 @@ var gZenUIManager = {
} catch (error) {
console.error('Error updating layout breakout:', error);
}
setTimeout(() => {
ZenWorkspaces.updateTabsContainers();
}, 0);
if (!this._preventToolbarRebuild) {
setTimeout(() => {
ZenWorkspaces.updateTabsContainers();
}, 0);
}
delete this._preventToolbarRebuild;
},
get tabsWrapper() {

View File

@@ -1973,7 +1973,8 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
const newTransform = `translateX(${offset}%)`;
if (shouldAnimate) {
if (element.classList.contains('zen-workspace-pinned-tabs-section') && this.containerSpecificEssentials) {
await this.updateTabsContainers(element, true);
// Note: Do not call with await on purpose, for better timing on animations
this.updateTabsContainers(element, true);
}
element.removeAttribute('hidden');
animations.push(
@@ -2102,6 +2103,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}
}
if (shouldAnimate) {
gZenUIManager._preventToolbarRebuild = true;
gZenUIManager.updateTabsToolbar();
}
await Promise.all(animations);
@@ -2296,7 +2298,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}
async updateTabsContainers(target = undefined, forAnimation = false) {
if (target && !(target instanceof HTMLElement)) {
if (target && !target.parentNode) {
target = null;
}
await this.onPinnedTabsResize([{ target: target ?? this.pinnedTabsContainer }], forAnimation);