Skip to content

feat(tab-bar): add shortcut to open commands for active tab group#6325

Open
agch-dev wants to merge 6 commits into
stablyai:mainfrom
agch-dev:feat/add-shortcut-to-open-commands-for-active
Open

feat(tab-bar): add shortcut to open commands for active tab group#6325
agch-dev wants to merge 6 commits into
stablyai:mainfrom
agch-dev:feat/add-shortcut-to-open-commands-for-active

Conversation

@agch-dev

@agch-dev agch-dev commented Jun 25, 2026

Copy link
Copy Markdown

Summary

Implements #6266

Users will now be able to open the Quick Commands Menu with a keyboard shortcut of their choosing. Making it easier to continue with the natural flow of using the keyboard to start searching for the command to run. Eliminating the necessary step of using the mouse to interact with the feature.

Screenshots

quick-commands-shortcut-demo.mp4

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that would catch regressions, or explained why tests were not needed

AI Review Report

Risk area Outcome
Hardcoded metaKey/ctrlKey None — matching delegates to keybindingMatchesAction +
getShortcutPlatform()
Shortcut label rendering Platform-aware — Mac gets /, Linux/Windows gets Ctrl+/Shift+
Electron accelerator strings No default binding registered, so no accelerator hardcoding risk
Keydown listener scope capture: true + stopImmediatePropagation(), scoped to component lifecycle
SSH / local-only assumptions None — logic runs entirely in the renderer process

Security Audit1

Area Finding
Input handling keydown listener uses keybindingMatchesAction for key comparison — no eval or
string execution. Search input is client-side filter only.
Command execution runAndClose dispatches a pre-stored quick command — existing behavior, no new
shell execution surface.
XSS All labels rendered via React JSX (auto-escaped). withShortcutHint returns a plain string used
as JSX text content — safe.
Path handling No file paths introduced.
Auth / secrets None present in the diff.
Dependencies No new npm packages added.
IPC No new Electron IPC channels. Shortcut listener is renderer-process only.
Event listener hijacking stopImmediatePropagation on capture phase is intentional scoping,
consistent with existing patterns — no unintended event suppression risk identified.

Follow-up needed: None.

Notes

  • I had to refactor the TabBarQuickCommandsMenu and extract the renderItem into TabBarQuickCommandItem (src/renderer/src/components/tab-bar/TabBarQuickCommandItem.tsx). This is because the file reached the 400 lines limit. Let me know if another approach would have been better.
  • As I flagged in the PR, there are some discrepancies on whether the state gets cleared when closing the Quick Commands menu which perhaps needs some tuning. Search state is cleared when user just closes the menu but is not when they edit a command, delete a command, or add a new command. It is also not cleared when a user runs a command but that perhaps is more understandable and intended. Happy to take a look at fixing it at another PR if this is considered as needing fixing.

agch-dev added 5 commits June 24, 2026 18:26
- New `tab.openQuickCommandsMenu` keybinding action (no default binding)
- TabBarQuickCommandsMenu listens for the binding and toggles open/closed
- Scoped to the active tab group naturally since the component only mounts when its group is focused
- Replace `setMenuOpen` toggle with `handleOpenChange(!menuOpen)` so closing
  via keyboard runs the same reset logic (query, focus frame, value override)
- Guard against key-repeat events to prevent rapid toggling on held key
- Wrap `handleOpenChange` in `useCallback` so it's stable enough to include
  in the `useEffect` dependency array without causing spurious re-registrations
- Update tests to reflect that re-running the effect between presses is
  required for the close path, and add a repeat-event test
@agch-dev agch-dev changed the title feat(tab-bar): dd shortcut to open commands for active feat(tab-bar): add shortcut to open commands for active Jun 25, 2026
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Added a new tab.openQuickCommandsMenu keybinding action with no default bindings and tests for its metadata and override behavior. Updated TabBarQuickCommandsMenu to show shortcut hints, register a capture-phase keydown handler that toggles the menu, and render quick commands through TabBarQuickCommandItem. Added keyboard tests for listener registration, toggling, propagation handling, cleanup, and the shortcut hint helper.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description includes the required Summary, Screenshots, Testing, AI Review Report, Security Audit, and Notes sections with relevant details.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately summarizes the main change: adding a shortcut to open the Quick Commands menu from the tab bar.

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.

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e337f717-924a-4147-9316-626bfc0a3e97

📥 Commits

Reviewing files that changed from the base of the PR and between c328ac8 and 6f299bf.

📒 Files selected for processing (5)
  • src/renderer/src/components/tab-bar/TabBarQuickCommandItem.tsx
  • src/renderer/src/components/tab-bar/TabBarQuickCommandsMenu.keyboard.test.ts
  • src/renderer/src/components/tab-bar/TabBarQuickCommandsMenu.tsx
  • src/shared/keybindings.test.ts
  • src/shared/keybindings.ts

Comment thread src/renderer/src/components/tab-bar/TabBarQuickCommandsMenu.tsx Outdated
Comment on lines +42 to +44
function withShortcutHint(label: string, shortcutLabel: string | null): string {
return shortcutLabel ? `${label} (${shortcutLabel})` : label
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

There is an identical function at src/renderer/src/components/floating-terminal/FloatingTerminalWindowControls.tsx. I wanted to extract it into somewhere so that it could be reused but wasn't sure of the placement.

Happy to move it and reuse if placement guidance is given.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

this comment is not outdated, I just added a docstring on top

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/renderer/src/components/tab-bar/TabBarQuickCommandsMenu.tsx (1)

346-353: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Route item-action closes through handleOpenChange.

These handlers close with runAndClose/setMenuOpen(false), bypassing the cleanup in handleOpenChange(false), so query and selection override can remain stale when reopening after run/edit/delete.

Proposed fix
   const runAndClose = useCallback(
     (command: TerminalQuickCommand): void => {
-      setMenuOpen(false)
+      handleOpenChange(false)
       onRunCommand(command)
     },
-    [onRunCommand]
+    [handleOpenChange, onRunCommand]
   )
                   onEdit={() => {
-                    setMenuOpen(false)
+                    handleOpenChange(false)
                     onEditCommand(command)
                   }}
                   onDelete={() => {
-                    setMenuOpen(false)
+                    handleOpenChange(false)
                     onDeleteCommand(command)
                   }}
                   onEdit={() => {
-                    setMenuOpen(false)
+                    handleOpenChange(false)
                     onEditCommand(command)
                   }}
                   onDelete={() => {
-                    setMenuOpen(false)
+                    handleOpenChange(false)
                     onDeleteCommand(command)
                   }}

Also applies to: 364-371


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4cc91c55-0705-4ce3-bdd4-7bebd305454c

📥 Commits

Reviewing files that changed from the base of the PR and between 6f299bf and 91f918f.

📒 Files selected for processing (2)
  • src/renderer/src/components/tab-bar/TabBarQuickCommandsMenu.keyboard.test.ts
  • src/renderer/src/components/tab-bar/TabBarQuickCommandsMenu.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/components/tab-bar/TabBarQuickCommandsMenu.keyboard.test.ts

@agch-dev

Copy link
Copy Markdown
Author

@coderabbitai help

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

CodeRabbit commands

These commands are invoked using PR/Issue comments.

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai rate limit to show your current review rate limit status.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai evaluate custom pre-merge check --instructions <custom-checks-instructions> --name <custom-checks-title> [--mode <error|warning>] to validate the custom pre-merge checks instructions. Defaults to error when --mode is omitted.
  • @coderabbitai ignore pre-merge checks to override pre-merge checks and get an approval on PR.
  • @coderabbitai run pre-merge checks to run pre-merge checks on the pull request.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai emit path instructions to emit generated path-specific review instructions for this repository.
  • @coderabbitai resolve merge conflict to automatically resolve merge conflicts.
  • @coderabbitai autofix to automatically fix issues identified in unresolved review comments.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai generate configuration to create a PR that adds the current resolved configuration as .coderabbit.yaml (or show it if already present).
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit configuration file (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, support, documentation and community

  • Visit our status page to check the current availability of CodeRabbit.
  • Create a ticket on our support page for assistance with any issues or questions.
  • Visit our documentation site for detailed information on how to use CodeRabbit.
  • Join our Discord community to connect with other users and get help from the community.
  • Follow us on X/Twitter for updates and announcements.

@agch-dev

Copy link
Copy Markdown
Author

@coderabbitai run pre-merge checks

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Running Pre-merge checks. Results will be posted in the summary comment once complete.

@agch-dev

Copy link
Copy Markdown
Author

@coderabbitai generate docstrings

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

This command requires write access to the repository. Only users with write or admin permissions can trigger CodeRabbit to commit or create pull requests.

@AmethystLiang AmethystLiang requested a review from Jinwoo-H June 25, 2026 16:50
@agch-dev agch-dev changed the title feat(tab-bar): add shortcut to open commands for active feat(tab-bar): add shortcut to open commands for active tab group Jun 25, 2026
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.

2 participants