Skip to content

feat(sidebar): add Cmd+B shortcut to toggle sidebar collapse#5618

Merged
waleedlatif1 merged 4 commits into
stagingfrom
feat/cmd-b-toggle-sidebar
Jul 12, 2026
Merged

feat(sidebar): add Cmd+B shortcut to toggle sidebar collapse#5618
waleedlatif1 merged 4 commits into
stagingfrom
feat/cmd-b-toggle-sidebar

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Add Mod+B (⌘B / Ctrl+B) as a global command to toggle the workspace sidebar collapsed/expanded
  • Registered through the central COMMAND_DEFINITIONS registry and the sidebar's existing useRegisterGlobalCommands block, calling the same toggleCollapsed store action as the collapse button
  • Rich markdown editor claims Mod+B via its existing data-owned-shortcuts mechanism so bold keeps working inside the editor (same pattern it already uses for Mod+K links)
  • Surface the shortcut in the collapse button tooltip (SidebarTooltip gains an optional shortcut prop rendering Tooltip.Shortcut)

Type of Change

  • New feature

Testing

Typecheck clean (one pre-existing unrelated error on staging), global-commands-provider and editor keymap tests pass (30/30)

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Jul 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 12, 2026 4:28am

Request Review

@cursor

cursor Bot commented Jul 12, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
UI keyboard shortcut and a small focus-detection fix in global commands; Mod+B in the rich editor remains handled via existing data-owned-shortcuts yielding.

Overview
Adds a workspace Mod+B (⌘B / Ctrl+B) global command to toggle sidebar collapse, wired through COMMAND_DEFINITIONS as toggle-sidebar and registered in the sidebar with the same toggleCollapsed action as the collapse control.

SidebarTooltip now accepts an optional shortcut and shows Tooltip.Shortcut on the collapse button tooltip.

GlobalCommandsProvider refactors the editable guard with isEditableElement, treating contenteditable="false" as non-editable so commands with allowInEditable: false can still run when a read-only rich-text surface has focus. New provider tests cover inputs, real contenteditable regions, and contenteditable="false".

Reviewed by Cursor Bugbot for commit aa8f7b8. Configure here.

@greptile-apps

greptile-apps Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a keyboard shortcut for collapsing and expanding the workspace sidebar. The main changes are:

  • Adds Mod+B as the sidebar toggle command.
  • Registers the command in the sidebar with the existing collapse action.
  • Keeps the shortcut disabled while focus is in editable controls.
  • Shows the shortcut in the collapse button tooltip.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/providers/global-commands-provider.tsx Adds a shared editable guard before running commands that should not fire inside editable controls.
apps/sim/app/workspace/[workspaceId]/providers/global-commands-provider.test.tsx Adds tests for the editable guard across inputs, contenteditable elements, and contenteditable=false elements.
apps/sim/app/workspace/[workspaceId]/utils/commands-utils.ts Adds the toggle-sidebar command definition with the Mod+B shortcut.
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx Registers the sidebar toggle command and renders the shortcut in the collapse tooltip.

Reviews (4): Last reviewed commit: "fix(sidebar): don't dead-zone Cmd+B on r..." | Re-trigger Greptile

Comment thread apps/sim/app/workspace/[workspaceId]/utils/commands-utils.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit aa8f7b8. Configure here.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit aa8f7b8. Configure here.

@waleedlatif1 waleedlatif1 merged commit 1fe94d3 into staging Jul 12, 2026
11 checks passed
@waleedlatif1 waleedlatif1 deleted the feat/cmd-b-toggle-sidebar branch July 12, 2026 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant