Skip to content

fix(web): handle sidebar shortcut before editors#3921

Open
Bortlesboat wants to merge 2 commits into
pingdotgg:mainfrom
Bortlesboat:fix/3833-sidebar-shortcut
Open

fix(web): handle sidebar shortcut before editors#3921
Bortlesboat wants to merge 2 commits into
pingdotgg:mainfrom
Bortlesboat:fix/3833-sidebar-shortcut

Conversation

@Bortlesboat

@Bortlesboat Bortlesboat commented Jul 12, 2026

Copy link
Copy Markdown

Summary

  • register the global sidebar shortcut handler in the capture phase
  • resolve configured sidebar commands before a focused rich-text editor consumes Mod+B
  • preserve the existing preventDefault/stopPropagation behavior after a match

Closes #3833

Verification

  • pnpm exec vp check (0 errors; existing unrelated warnings only)
  • pnpm exec vp run typecheck (all 15 workspaces passed; existing suggestions only)
  • git diff --check

Note

Low Risk
Small keyboard-event ordering change with an explicit opt-out for keybinding capture inputs; no auth, data, or API impact.

Overview
Fixes sidebar toggle (Mod+B by default) being swallowed by focused rich-text editors by handling the shortcut earlier in the event pipeline.

In SidebarControl, the global keydown listener now runs in the capture phase so sidebar.toggle can preventDefault / stopPropagation before editors apply bold formatting. The handler also bails out when the event target is inside [data-keybinding-capture], so recording shortcuts in Keybindings settings is not overridden by the global sidebar handler.

Keybinding edit inputs (existing and new rows) are tagged with data-keybinding-capture="" to opt into that exception.

Reviewed by Cursor Bugbot for commit a881201. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix sidebar toggle shortcut to use capture phase and skip keybinding inputs

  • The sidebar toggle keydown handler in AppSidebarLayout.tsx now registers on the capture phase so it runs before focused editors consume the shortcut.
  • Adds a guard to skip the shortcut when the event originates from an element marked with [data-keybinding-capture].
  • Keybinding edit and create inputs in KeybindingsSettings.tsx are marked with data-keybinding-capture so the sidebar toggle does not fire while editing shortcuts.

Macroscope summarized a881201.

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 9e48e2ab-7651-49e5-87a3-6c2fc37bb477

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Jul 12, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread apps/web/src/components/AppSidebarLayout.tsx
@macroscopeapp

macroscopeapp Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Straightforward bug fix that switches the sidebar toggle shortcut listener to capture phase so it executes before rich-text editors that use the same shortcut. Changes are limited in scope with an appropriate opt-out mechanism for keybinding input fields.

You can customize Macroscope's approvability policy. Learn more.

@github-actions github-actions Bot added size:S 10-29 changed lines (additions + deletions). and removed size:XS 0-9 changed lines (additions + deletions). labels Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Sidebar doesn't close with keyboard shortcut when focusing chat box

1 participant