fix(web): handle sidebar shortcut before editors#3921
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 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 |
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.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5fa8008. Configure here.
| return () => window.removeEventListener("keydown", onKeyDown); | ||
| // Capture before focused editors consume commands such as Mod+B for rich-text formatting. | ||
| window.addEventListener("keydown", onKeyDown, true); | ||
| return () => window.removeEventListener("keydown", onKeyDown, true); |
There was a problem hiding this comment.
Capture blocks keybinding recording
Low Severity
Registering the sidebar shortcut on window in the capture phase makes it run before focused elements receive keydown. On keybindings settings, pressing the chord currently assigned to sidebar.toggle (default mod+b) toggles the sidebar and stops propagation, so the recording Input never records that press.
Reviewed by Cursor Bugbot for commit 5fa8008. Configure here.
ApprovabilityVerdict: Needs human review This PR changes keyboard event handling from bubble to capture phase. An unresolved review comment identifies that this may break keybinding recording functionality, as the sidebar toggle will intercept events before the recording input can capture them. You can customize Macroscope's approvability policy. Learn more. |


Summary
Closes #3833
Verification
Note
Low Risk
Single listener option change in one component; behavior is narrower (sidebar shortcut wins earlier) with no auth or data impact.
Overview
Fixes ⌘/Ctrl+B toggling the main sidebar when a rich-text editor is focused, where the same chord was being consumed for bold formatting instead.
The global
sidebar.togglehandler inSidebarControlnow registerskeydownin the capture phase (addEventListener(..., true)), so configured shortcuts are resolved and canpreventDefault/stopPropagationbefore focused editors see the event. Cleanup uses the same capture flag.Reviewed by Cursor Bugbot for commit 5fa8008. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix sidebar toggle shortcut to intercept keydown events before focused editors
The
SidebarControlkeydown listener in AppSidebarLayout.tsx now registers in the capture phase (truepassed toaddEventListener/removeEventListener), soMod+Bis handled by the sidebar before focused editors consume it.Macroscope summarized 5fa8008.