diff --git a/src/zen/spaces/ZenSpaceManager.mjs b/src/zen/spaces/ZenSpaceManager.mjs index 406cd8a04..727d0e754 100644 --- a/src/zen/spaces/ZenSpaceManager.mjs +++ b/src/zen/spaces/ZenSpaceManager.mjs @@ -432,8 +432,9 @@ class nsZenWorkspaces { // Set a hidden state if the essentials section is not supposed // to be shown on the current workspace, else remove the hidden state if ( - this.containerSpecificEssentials && - this.getActiveWorkspaceFromCache()?.containerTabId != container + this.activeWorkspace === this.creatingWorkspaceId || + (this.containerSpecificEssentials && + this.getActiveWorkspaceFromCache()?.containerTabId + 0 != container) ) { essentialsContainer.setAttribute("hidden", "true"); } else { diff --git a/src/zen/tests/container_essentials/browser_container_specific_essentials.js b/src/zen/tests/container_essentials/browser_container_specific_essentials.js index 4097e4027..f1a88c7ee 100644 --- a/src/zen/tests/container_essentials/browser_container_specific_essentials.js +++ b/src/zen/tests/container_essentials/browser_container_specific_essentials.js @@ -46,3 +46,38 @@ add_task(async function test_Check_Creation() { await gZenWorkspaces.removeWorkspace(newWorkspaceUUID); }); + +add_task(async function test_Essentials_Hidden_Workspace_Creation() { + const originalWorkspace = gZenWorkspaces.getActiveWorkspace(); + + const essentialTab = BrowserTestUtils.addTab(gBrowser, "about:blank", { + skipAnimation: true, + userContextId: 0, + }); + gZenPinnedTabManager.addToEssentials(essentialTab); + const essentialsContainer = essentialTab.parentNode; + + await gZenWorkspaces.createAndSaveWorkspace( + "Empty Container Workspace", + undefined, + false, + 1 + ); + const emptyWorkspace = gZenWorkspaces.getActiveWorkspace(); + + // The temporary creation workspace uses container 0, which previously + // caused the container 0 Essentials to reappear over the form. + await gZenWorkspaces.openWorkspaceCreation(); + + const creationForm = document.querySelector("zen-workspace-creation"); + ok(creationForm, "Workspace creation form is shown"); + ok( + BrowserTestUtils.isHidden(essentialsContainer), + "Essentials remain hidden while creating a workspace" + ); + + await creationForm.onCancelButtonCommand(); + await gZenWorkspaces.changeWorkspace(originalWorkspace); + await gZenWorkspaces.removeWorkspace(emptyWorkspace.uuid); + await BrowserTestUtils.removeTab(essentialTab); +});