fix(app): ignore collapsed side-panel tabs when closing a tab (#54695)

This commit is contained in:
Kit Langton
2026-10-12 00:32:29 -07:00
committed by GitHub
Unverified
parent 6d1be26251
commit 3e78cd58e0
2 changed files with 16 additions and 1 deletions
@@ -731,9 +731,22 @@ test("restores review state and the side-panel tab per session", async ({ page }
await selectedFile("gamma.ts")
await review.press("End")
await selectedTab("README.md")
// A hidden side-panel tab does not claim Close Tab while the side region is collapsed.
await toggle.click()
await expect(panel).toBeHidden()
await page.keyboard.press("Control+w")
await expect(page.locator("[data-titlebar-tab-slot]", { hasText: "Alpha review state" })).toHaveCount(0)
await expectSessionTitle(page, "Beta review state")
await page.keyboard.press("Control+Shift+T")
await expectSessionTitle(page, "Alpha review state")
await toggle.click()
await selectedTab("README.md")
await page.keyboard.press("Control+w")
await expect(panel.getByRole("tab", { name: "README.md", exact: true })).toHaveCount(0)
await expect(review).toHaveAttribute("aria-selected", "true")
await expectSessionTitle(page, "Alpha review state")
})
test("shows and restores last turn changes from the session diff", async ({ page }) => {
@@ -71,8 +71,10 @@ export const useSessionCommands = (actions: SessionCommandContext) => {
// The file the selected side tab shows; other tabs have no line selection.
const activeFile = () => actions.region.selected()?.tab.file
// Pinned tabs stay open.
// Pinned tabs stay open, and hidden side-panel tabs do not claim Close Tab while the region is collapsed.
const closableTab = () => {
if (!actions.session.layout.view().side.opened()) return
const entry = actions.region.selected()
return entry && !entry.tab.pinned ? entry.key : undefined