Repository navigation
fix(app): ⌘W closes the side panel when nothing in it is left to close - #59002
kitlangton wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
The fix is sound. I put the new e2e test into a copy of the base branch, where it fails: the panel stays open after the second ⌘W. With this PR it passes, along with the three existing ⌘W and side-panel tests in tabs.spec.ts. tsc -b in packages/app is clean.
The new fallback can't open the panel: onSelect returns early when the side panel is closed. It closes through the same region.toggle() as ⇧⌘R, and the existing guard still catches an extra ⌘W.
Public API: unchanged (app keyboard handling only).
No blocking concerns.
There was a problem hiding this comment.
The new commit is sound. It keeps focus in the side panel when ⌘W removes a focused New tab, so the next ⌘W closes the panel and gives focus back to the composer. The updated e2e test fails without the new code, and passes with it along with the other ⌘W and side-panel tests. tsc -b in packages/app is clean.
Public API: unchanged.
No new concerns.
What it does
Opening the side panel with ⇧⌘R shows a New tab. ⌘W closes that New tab, but the next ⌘W did nothing: the panel stayed open and empty, and only ⇧⌘R closed it. Now, with focus in the side panel, ⌘W closes the panel itself once nothing in it is left to close, the way an editor closes the focused pane before the window.
How it works
With focus in the side panel, ⌘W now closes, in order:
With focus outside the side panel, ⌘W still closes the session tab. The existing guard still swallows one extra ⌘W after the panel closes, so a quick double press never closes the session. The bottom panel (⌘J) is unchanged.
Risk
Desktop and web app keyboard handling only. A panel whose only tab is pinned now closes on ⌘W instead of ignoring it.
Proof
bunx playwright test e2e/regression/tabs.spec.ts -g "⌘W|side-panel tabs": 4 passed. The new test fails without the fix (the panel stays open after the second ⌘W).bun typecheckinpackages/app: clean.bun script/lint-changed.ts origin/beta: 0 problems.Base is
beta: the side panel's New tab view and the ⌘W guard this builds on only exist there.