Repository navigation
fix(desktop): add close window on cmd+shift+w to the macos window menu - #31403
Conversation
On macOS the main dashboard window had no keyboard way to close it. Cmd+W is "close session" in the renderer on every platform, and the stock macOS Window menu has no Close entry, so nothing closed the window from the keyboard. Write the macOS Window menu out as the stock items plus Close Window on Cmd+Shift+W, matching Ctrl+Shift+W on Windows/Linux. The menu keeps the windowMenu role, so AppKit still lists the open windows. Close is the native role: it fires the same close event as the red button, so the main window hides to the tray (leaving fullscreen first) or quits when set to, and a second window just closes. Cmd+W still reaches the renderer. Closes #11393
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. This is a small, reversible menu addition that uses Electron's own Notes
[DESIGN-REVIEWED] 769ade9 Description read[DESCRIPTION-READ] 60b0ff0eb5bcf2b445367662a90a91cce32f03e0ed0c2f12b274c12b06b7f37f That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The fix adds one menu item for a linked defect (#11393). The old test said "no Close entry, so Cmd+W reaches the page", and its reason still holds because Close now uses the Shift chord. What this change shipsInventory (3 items) — 3 justifiedIntent: let a macOS user close the focused dashboard window from the keyboard while Cmd+W keeps closing the session. FIX.
[FIRST-PRINCIPLES-REVIEWED] 769ade9 Description read[DESCRIPTION-READ] ec15fd0f86f1c2d5857a3ed2c7bc0cf124eff4996f84652f2e02083b7ef1d108 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks. The screenshot shows the one added item, "Close Window ⇧⌘W". The blind reader read it correctly ("closes this window") and said they would use it. Notes
[UX-REVIEWED] 769ade9 Description read[DESCRIPTION-READ] 0d68956dfa4e57ceb62ebc3e0dd07daf682ae7210a77cfa37d43e587e122ebe5 That sha256 names everything this verdict read: the PR description, plus the 4 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
buluoray
left a comment
There was a problem hiding this comment.
🤖 Kiro Crew Auto-Pipeline [operator: buluoray]:
APPROVE. Reviewed at 769ade9.
What it does for users: on macOS, Cmd+Shift+W now closes the focused dashboard window through a Close Window item in the Window menu, the same chord Windows and Linux already use. Cmd+W stays "close session". Before this, the red traffic-light button was the only way to close the window on macOS (#11393).
Evidence
- website/electron/app-menu.js:169-181: the macOS branch keeps role windowMenu (so AppKit still lists open windows) and writes out minimize, zoom, front and close, with close on Cmd+Shift+W. The close role fires the window's own close event, which the existing handler at website/electron/window-lifecycle.js:934 handles, so hide-to-tray and quit behave as they do for the red button.
- Shortcut collisions: I searched website/src and website/electron for every W chord. The renderer registry claims Cmd/Ctrl+W (close-chat) and its Option/Alt+Shift+W alias (website/src/lib/shortcutRegistry.ts:171-172). Its matcher requires Shift to match exactly (website/src/lib/shortcutRegistry.ts:422), so Cmd+Shift+W never matches close-chat. No other registry entry and no other menu item uses Cmd+Shift+W. The one overlap is File Explorer's tab-close listener (website/src/apps/file-explorer/FileExplorerPage.tsx:432), which ignores Shift. The PR body names it, and Ctrl+Shift+W on Windows/Linux has the same overlap today.
- Spec: the owning spec for the desktop shell is website/electron/README.md. Its Menus table gains the row in the same commit.
- Tests: website/electron/test/app-menu.test.js passes 33 of 33.
- Mutation: with the macOS Close item removed from app-menu.js, the test "mac: Window menu keeps the stock role and adds Close on Cmd+Shift+W (Cmd+W reaches the page)" goes red (32 pass, 1 fail). The tree was restored and is clean.
- CI: 77 success and 17 skipped check runs, with no failures. PR Readiness and both CodeBuild statuses are green. Every bot lane (Design, First Principles, UX, Opus, GPT) passes at this head. The PR merges cleanly into main.
Source-only: everything on macOS. This review ran on Linux, so AppKit's menu rendering, the Close All alternate, fullscreen and second-window behaviour were not exercised here. The PR body's manual macOS table is the author's evidence, and I did not reproduce it. One point is open on that basis. In Electron the page sees a key press before the menu does, so on the File Explorer page the listener's preventDefault may keep the menu's Close from firing at all. In that case Cmd+Shift+W would close only the file tab, while the body says the chord reaches "both that listener and the new menu item". I could not check which of the two happens. Neither outcome loses data.
Follow-ups (non-blocking)
- Make the File Explorer tab-close listener require that Shift is not held, so Cmd/Ctrl+Shift+W always means "close window" on every page. The Design lane suggested this too.
- The comment at website/src/lib/shortcutRegistry.ts:169-170 still says only Windows/Linux move the window close to the Shift chord. That is still true for those platforms, but it now applies to macOS as well and can say so.
#31403) On macOS the main dashboard window had no keyboard way to close it. Cmd+W is "close session" in the renderer on every platform, and the stock macOS Window menu has no Close entry, so nothing closed the window from the keyboard. Write the macOS Window menu out as the stock items plus Close Window on Cmd+Shift+W, matching Ctrl+Shift+W on Windows/Linux. The menu keeps the windowMenu role, so AppKit still lists the open windows. Close is the native role: it fires the same close event as the red button, so the main window hides to the tray (leaving fullscreen first) or quits when set to, and a second window just closes. Cmd+W still reaches the renderer. Closes #11393 (cherry picked from commit c318773)
Problem / Motivation
Goal: On macOS, Cmd+Shift+W closes the focused dashboard window from a Close Window item in the Window menu, while Cmd+W keeps closing the current session.
On macOS nothing on the keyboard closes the main dashboard window (#11393). Cmd+W is "close session" on every platform by design (#9555), and the stock macOS Window menu has no Close item, so the only way to close the window is the red traffic-light button. Windows and Linux already close the window with Ctrl+Shift+W.
Why it matters
A macOS user who reaches for a close-window shortcut gets nothing and has to use the mouse. A maintainer asked for exactly this follow-up when closing #11399: a Close Window item on Cmd+Shift+W in the macOS Window menu, matching Ctrl+Shift+W on Windows/Linux.
Not a goal
What changed (motivation → approach → change)
On macOS, Cmd+Shift+W closes the focused window, and the Window menu shows it as Close Window. Cmd+W still closes the session.
The macOS branch of
website/electron/app-menu.jsused Electron's stockwindowMenurole. That menu has Minimize, Zoom and Bring All to Front but no Close, and Cmd+W belongs to the renderer, so no key closed the window.The macOS Window menu is written out: the stock items plus
{ role: "close", accelerator: "Cmd+Shift+W" }, the same chord Windows/Linux use. It keepsrole: "windowMenu", which is what makes AppKit list the open windows at the bottom. The close role fires the window's owncloseevent, the same one the red button fires, so the existing close handler decides what happens. The renderer's shortcut registry has nothing on Cmd+Shift+W, since it matches Shift exactly. The Menus table inwebsite/electron/README.mdgains the row.Backwards compatibility
Compatible: the macOS Window menu keeps its role and every stock item, and gains one item on Cmd+Shift+W. One page listener also reacts to that chord: File Explorer closes its active file or folder tab on Cmd+W without checking Shift, so on that page Cmd+Shift+W now meets both that listener and the new menu item. Ctrl+Shift+W has the same overlap on Windows/Linux today.
Removes nothing: the menu only gains an item; Cmd+W, the renderer registry, the File Explorer listener and the close handler are untouched.
Tests
website/electron/test/app-menu.test.js: the macOS Window menu test pinsrole: "windowMenu", theminimize,zoom,frontandcloseroles, Close onCmd+Shift+W, and noclickon Close (Electron owns the close). The shared "no menu item claims CmdOrCtrl+N or CmdOrCtrl+W" test is unchanged and green, which keeps Cmd+W with the renderer.app-menu.jsfrom main and the new test, 1 of 33 tests fails (the new one); with the fix, 33 of 33 pass.node --test --test-randomizewith 10 seeds passes 10 of 10.npm run test:electronon macOS: 3243 pass, 0 fail, 12 skipped. CI runs the Electron job on Linux only, so this is the macOS run.Proof: not provable -- frontend test (prove.py runs Python only)
Manual verification
macOS 26.7.2 (25G332) on Apple silicon, Electron 44.9.1 (
electron ~44.9.1). The dev shell ran from this branch with its own user-data dir, against an isolated gateway on a scratch data home. Keys were real key presses sent to the app.Kiro Crew [:<port>]). The same menu on main has no Close item.close: hiding to tray (fullScreen=false), the same line the red button logsclose: hiding to tray (fullScreen=true), thenfullscreen: exit transition startedandfullscreen: left; the app hides and none of its windows stay on screenclose: quitting (closeAction=quit)AppKit adds its usual Option alternate, Close All (⌥⇧⌘W), under Close Window. No renderer shortcut uses that chord.
Not exercised: the Cmd+W confirm prompt on a busy session, since no chat turn ran, and Cmd+Shift+W on the File Explorer page. Both are renderer code this PR does not change.
Screenshots / video
The macOS Window menu with this change, captured from the app's own menu window, is attached at the end of this description: Close Window on ⇧⌘W sits above the open-window list.
Related Issues
Closes #11393
Follows the maintainer's request on #11399. Cmd+W as "close session": #9555.
Sibling sweep
Swept: git grep -n -e 'role: "windowMenu"' -e 'role: "close"' -e 'Shift+W' -- website/electron/
Swept:
git grep -nE "key(\.toLowerCase\(\))? ?={2,3} ?'[wW]'|key: '[wW]'" -- website/srcSibling: website/electron/app-menu.js -- changed here
Sibling: website/src/apps/file-explorer/FileExplorerPage.tsx:432 -- not affected -- it closes a file or folder tab, not the window, so it has no missing window close
The first search finds one other window close: the Windows/Linux branch of the same template, which already puts Close on Ctrl+Shift+W. No other menu carries one. The second finds the renderer's W listeners: the shortcut registry's
close-chatand File Explorer's tab close, which Backwards compatibility names.Pattern harvest
Not generalizable: one platform's menu missed one item that the other platform's menu had, and app-menu.test.js now pins the Window menu on both platforms.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license (see the Licensing section of CONTRIBUTING.md).