Add right panel close controls - #4148
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Needs human review This PR introduces a new feature (right panel close controls) with significant new logic including focus tracking, shortcut routing, and behavioral changes to how Cmd+W works. Combined with an unresolved review comment about a potential race condition, this warrants human review. You can customize Macroscope's approvability policy. Learn more. |
|
what is the interaction demo doing? looks like you're just toggling visibility which you can already do with |
|
pressing cmd+w to close a single panel, since in the vid there was only one, the whole panel closed, sorry for the bad video, ill record another one |
|
Updated the PR description with a separate real-app middle-click demo. It starts with Files and Terminal open, then middle-click closes only Files while Terminal, the right panel, and the app window stay open. I also added focused regression coverage for button 1 and clarified what the existing Cmd+W clip is showing. |
|
Follow-up review fix in 85e780f: hosted preview focus is now matched by tab ID against the active right-panel preview, so a standalone preview cannot trigger the right-panel close shortcut. The focused tests cover matching and mismatched preview IDs. |
85e780f to
4935f60
Compare
Keep native close focus scoped to the active hosted preview and preserve pointer ownership across webview blur transitions. Co-authored-by: codex <codex@users.noreply.github.com>
4935f60 to
137c501
Compare
e034689 to
5227956
Compare
5227956 to
6f86978
Compare
525834d to
bfc65e4
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 117cbae. Configure here.

What Changed
rightPanel.closeActiveSurfacecommand, defaulting toMod+Wwhile the right panel owns focus.Why
The right panel had no explicit hide control, and
Cmd+Wcould close the desktop window instead of the focused panel surface.Closes #4146.
Closes #4147.
UI Changes
Before
After
Interaction
Watch the real-app interaction demo
The clip starts with Files and Diff open.
Cmd+Wcloses only Diff, the far-right X hides the panel, and the existing toggle restores Files to show that panel state is preserved.Validation
git diff --checkpassedChecklist
Note
Medium Risk
Touches global shortcuts, macOS window-close interception, and persisted keybinding migration; behavior changes when the right panel is open versus legacy terminal-only Mod+W.
Overview
Adds a far-right close control on the inline right panel and wires focus-aware close so
Mod+Wcloses the active right-panel surface (or its terminal) instead of quitting the app when the panel has focus.Keybindings & migration: New
rightPanel.closeActiveSurface(defaultmod+wwhenrightPanelFocus);terminal.closeis limited toterminalFocus && !rightPanelFocus. Server startup migrates legacymod+wterminal-close configs and documents the newwhencontext.Desktop: On macOS, main-window
Cmd+Wis intercepted and sent to the renderer asclose-window-or-focused-region(still closes the window while the main frame is loading). Preview webviews receive configured close shortcuts over IPC so embedded browser input forwards remapped bindings, not a hardcodedMod+W.Web:
closeFocustracking,rightPanelFocusscope (including portaled controls), and a shared close-request path inChatView/ sidebar menu handling unify keyboard, menu, and preview forwarding.Reviewed by Cursor Bugbot for commit 02b9f3f. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add right panel close controls with focus-aware Cmd+W routing
PanelLayoutControlsand routesCmd+Wto close the focused right panel surface, right panel terminal, or drawer terminal based on where focus is tracked.createCloseFocusTrackerincloseFocus.tsto maintain stable focus ownership across native blur events, portals, drag regions, and preview tab switches.mod+wkeybinding into two:rightPanel.closeActiveSurfacewhenrightPanelFocusis active, andterminal.closeonly whenterminalFocus && !rightPanelFocus; includes a startup migration for existing persisted configs.Cmd+Win the desktop app is intercepted viabefore-input-eventand routed to the renderer asCLOSE_WINDOW_OR_FOCUSED_REGION_MENU_ACTIONinstead of immediately closing the window (unless the main frame is still loading).rightPanelCloseShortcutsvia a new IPC channel so the preview manager can forward the correct shortcut instead of always assumingMod+W.terminal.closedefault keybinding now requires!rightPanelFocus, which is a behavioral change for users whose right panel is open when they pressCmd+W.Macroscope summarized 02b9f3f.