Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 73e179b

Browse files
author
Jonathan Sudiaman
committed
Bug 1944842 - Sidebar can get into scenario where it's expanded but vertical tabs aren't showing labels r=sidebar-reviewers,sfoster
Disabling revamp means that we also set expanded to false. However, since revamp is disabled, these changes are not reflected back to sidebar-main, resulting in a weird mismatch between SidebarState and what the launcher sees. This was partially fixed by the lines in initializeState(), which updates the tab container, but not the launcher. This generalizes the solution to ensure that *all* components are kept up to date. Differential Revision: https://phabricator.services.mozilla.com/D236240
1 parent efde7db commit 73e179b

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

browser/components/sidebar/SidebarState.sys.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ export class SidebarState {
115115
} else {
116116
this.launcherVisible = true;
117117
}
118-
// Ensure that tab container has the updated value of `launcherExpanded`.
119-
const { tabContainer } = this.#controllerGlobal.gBrowser;
120-
tabContainer.toggleAttribute("expanded", this.launcherExpanded);
118+
119+
// Explicitly trigger effects to ensure that the UI is kept up to date.
120+
this.launcherExpanded = this.#props.launcherExpanded;
121121
}
122122

123123
/**

browser/components/sidebar/tests/browser/browser_vertical_tabs.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -439,17 +439,20 @@ add_task(async function test_vertical_tabs_expanded() {
439439
"Sidebar launcher is hidden."
440440
);
441441

442-
info("Enable revamped sidebar and vertical tabs.");
443-
Services.prefs.setBoolPref("sidebar.revamp", true);
442+
info("Enable vertical tabs.");
444443
Services.prefs.setBoolPref("sidebar.verticalTabs", true);
445444
await TestUtils.waitForCondition(
446445
() => BrowserTestUtils.isVisible(document.getElementById("sidebar-main")),
447446
"Sidebar launcher is shown."
448447
);
449-
ok(
448+
const expandedStateValues = [
449+
SidebarController.getUIState().launcherExpanded,
450+
SidebarController.sidebarMain.expanded,
450451
gBrowser.tabContainer.hasAttribute("expanded"),
451-
"Tab container is expanded."
452-
);
452+
];
453+
for (const val of expandedStateValues) {
454+
is(val, false, "Launcher is collapsed.");
455+
}
453456

454457
await SpecialPowers.popPrefEnv();
455458
});

0 commit comments

Comments
 (0)