Skip to content

Add sidebar toggle keyboard shortcut - #3960

Merged
shaunandrews merged 3 commits into
trunkfrom
ai/agent/stu-1900-1782405176
Jun 29, 2026
Merged

Add sidebar toggle keyboard shortcut#3960
shaunandrews merged 3 commits into
trunkfrom
ai/agent/stu-1900-1782405176

Conversation

@agent-sandbox-automattic

@agent-sandbox-automattic agent-sandbox-automattic Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Related issues

Closes STU-1900

How AI was used in this PR

AI produced the initial PR, then Codex reviewed the behavior, identified why the shortcut was incomplete, and updated the branch with a broader fix and test coverage.

Proposed Changes

Adds a reliable primary-modifier+B shortcut for toggling the sidebar: Cmd+B on macOS and Ctrl+B on Windows/Linux.

This fixes the original branch by making the shortcut work even when the native app menu is hidden, and by supporting both Studio renderer surfaces. Users can now toggle the sidebar consistently from the keyboard in the legacy Studio UI and the newer agentic UI.

The View menu entry remains available for discoverability.

Testing Instructions

  1. Build and launch the app.
  2. Open a site so the main sidebar is visible.
  3. Press Cmd+B on macOS, or Ctrl+B on Windows/Linux.
  4. Confirm the sidebar hides.
  5. Press the same shortcut again and confirm the sidebar shows.
  6. Confirm View → Toggle Sidebar still appears in the app menu.

Validated locally:

  • npx eslint --fix apps/studio/src/components/app.tsx apps/studio/src/main-window.ts apps/studio/src/tests/main-window.test.ts apps/ui/src/components/sidebar-layout/index.tsx apps/ui/src/components/sidebar-layout/index.test.tsx apps/ui/src/data/core/connectors/hosted/index.ts apps/ui/src/data/core/connectors/ipc/index.ts apps/ui/src/data/core/types.ts
  • npm test -- apps/studio/src/tests/main-window.test.ts
  • npm test -- apps/studio/src/components/tests/app.test.tsx
  • npm test -- apps/ui/src/components/sidebar-layout/index.test.tsx
  • npm run typecheck
  • git diff --check

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
matticbot and others added 2 commits June 25, 2026 16:37
Adds a View menu item with CommandOrControl+B accelerator that fires a
toggle-sidebar IPC event to the renderer, where app.tsx listens for it
and calls the existing toggleSidebar handler.

Co-authored-by: shaunandrews <shaun@automattic.com>
@shaunandrews
shaunandrews marked this pull request as ready for review June 25, 2026 18:15
@shaunandrews shaunandrews changed the title Add Cmd+B keyboard shortcut to toggle the sidebar Jun 25, 2026
@shaunandrews
shaunandrews requested review from a team and bcotrim June 25, 2026 18:21
@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing ce5b4dc vs trunk

app-size

Metric trunk ce5b4dc Diff Change
App Size (Mac) 1315.48 MB 1315.48 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk ce5b4dc Diff Change
load 737 ms 1112 ms +375 ms 🔴 50.9%

site-startup

Metric trunk ce5b4dc Diff Change
siteCreation 6485 ms 6516 ms +31 ms ⚪ 0.0%
siteStartup 6568 ms 6572 ms +4 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@gavande1 gavande1 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.

Nice @shaunandrews, I tested this and it works as advertised. LGTM 👍

@shaunandrews
shaunandrews merged commit f3cac29 into trunk Jun 29, 2026
11 checks passed
@shaunandrews
shaunandrews deleted the ai/agent/stu-1900-1782405176 branch June 29, 2026 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants