Skip to content

Keyboard-select composer controls with hold-modifier hints#4271

Open
colonelpanic8 wants to merge 10 commits into
pingdotgg:mainfrom
colonelpanic8:t3code/composer-keyboard-shortcuts
Open

Keyboard-select composer controls with hold-modifier hints#4271
colonelpanic8 wants to merge 10 commits into
pingdotgg:mainfrom
colonelpanic8:t3code/composer-keyboard-shortcuts

Conversation

@colonelpanic8

@colonelpanic8 colonelpanic8 commented Jul 22, 2026

Copy link
Copy Markdown

What

Makes every selector in the thread first-prompt composer keyboard-operable through the app's existing customizable keybindings system, extending the pattern already used by modelPicker.toggle.

Command Default Control
modelOptionsPicker.toggle mod+shift+e Reasoning effort / model traits menu
runtimeModePicker.toggle mod+shift+a Access level (Supervised / Auto-accept / Full access)
planMode.toggle mod+shift+p Plan ↔ Build toggle
environmentPicker.toggle mod+shift+v Branch toolbar environment
envModePicker.toggle mod+shift+l Local vs worktree
branchPicker.toggle mod+shift+b Branch selector

(mod = Ctrl on Linux/Windows, Cmd on macOS.)

All six are rebindable in Settings → Keybindings — they flow through the existing command registry, so their labels are derived by commandLabel and they're upserted into existing user configs by the server's startup sync. No new settings surface was added.

Hold-modifier hints

Holding the platform mod key reveals small Kbd hint badges for each control (mirroring the existing thread-jump number hints). For the composer controls the badge floats just below its trigger (a detached anchored tooltip), so the current values — model, effort, access level, Plan/Build — stay fully visible; the branch toolbar controls keep inline badges. Visibility is computed once via a new shouldShowComposerControlHintsForModifiers, which deliberately uses subset modifier matching (not the exact-match used by thread jumps) so that holding a bare Ctrl/Cmd reveals the full mod+shift+* chords.

Fallbacks

  • Compact footer: the effort/runtime toggles open CompactComposerControlsMenu; the Plan/Build toggle still flips directly.
  • Mobile: environment / env-mode open the combined MobileRunContextSelector menu.
  • Each toggle reports whether its control was actually available; when it wasn't (locked provider, approval pending, collapsed, etc.) the command no-ops without calling preventDefault, so the browser default still fires.

Tests

Extended keybinding coverage in packages/contracts, apps/web (mac vs non-mac, subset semantics, customized bindings, no-binding, label resolution), and apps/server defaults enumeration. Typecheck, lint, and full test suites pass (contracts 190, shared 272, web 1411, server keybindings 22).

🤖 Generated with Claude Code

Exact-head evidence

Revalidated at d0c50d2 on current main (9a0a071): focused tests, vp check, and vp run typecheck passed. The capture uses only disposable local projects.

Hold-modifier shortcut hints on composer controls


Note

Medium Risk
Touches global keydown handling and many UI state paths (compact vs desktop, mobile, locked env); incorrect availability or picker coordination could cause stuck overlays or swallowed shortcuts, but changes are mostly additive with tests.

Overview
Adds six rebindable commands (modelOptionsPicker, runtimeModePicker, planMode, environmentPicker, envModePicker, branchPicker) with default mod+shift+* chords, wired through contracts/shared defaults and handled in ChatView via imperative toggles on ChatComposer and BranchToolbar.

Composer and branch UI now use single active picker state (composer pickers + compact menu + branch toolbar overlays), with logic to replace rather than stack overlays, ignore stale close events, and reset on layout changes via useLayoutScopedOpenState. Mobile routes environment/env-mode shortcuts to the combined run-context menu.

Hold-modifier hints show Kbd labels when held modifiers are a subset of each binding (shouldShowCommandHintForModifiers), including terminal-focus when rules; composer controls use anchored ComposerControlShortcutHint tooltips. Toggles return false when unavailable so preventDefault is skipped and browser defaults still work.

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

Note

Add keyboard shortcuts to toggle composer and branch toolbar controls with modifier-held hints

  • Adds six default keybindings (mod+shift+e/a/p/v/l/b) mapped to modelOptionsPicker.toggle, runtimeModePicker.toggle, planMode.toggle, environmentPicker.toggle, envModePicker.toggle, and branchPicker.toggle in keybindings.ts.
  • Keyboard shortcut hints (Kbd badges) appear on composer and branch toolbar controls while the user holds the modifier keys; visibility is driven by new shouldShowComposerControlHintsForModifiers and shouldShowCommandHintForModifiers helpers in keybindings.ts.
  • Composer pickers (model, traits, runtime mode, compact controls menu) are now managed as mutually exclusive open states via resolveComposerPickerOpenChange in composerProviderState.tsx; only one picker can be open at a time.
  • Branch toolbar pickers (environment, env-mode, branch, mobile run-context) follow the same single-active-picker pattern, and BranchToolbar exposes an imperative BranchToolbarHandle for programmatic toggling from ChatViewContent.
  • A new useLayoutScopedOpenState hook in useLayoutScopedOpenState.ts ensures picker open state resets automatically on layout changes (e.g. mobile ↔ desktop).

Macroscope summarized d5ca73b.

@coderabbitai

coderabbitai Bot commented Jul 22, 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 Plus

Run ID: c29daa7e-a3d7-48d7-bdd5-21340646dc9d

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:L 100-499 changed lines (additions + deletions). labels Jul 22, 2026
Comment thread apps/web/src/components/chat/ChatComposer.tsx Outdated
Comment thread apps/web/src/components/chat/ChatComposer.tsx Outdated
@macroscopeapp

macroscopeapp Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces a new feature adding keyboard shortcuts and visual hold-modifier hints for composer controls. New features with new user-facing behavior warrant human review, especially given the modifications to core components like ChatComposer and BranchToolbar.

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

@github-actions github-actions Bot added size:XL 500-999 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Jul 22, 2026
Comment thread apps/web/src/components/BranchToolbar.tsx
colonelpanic8 added a commit to colonelpanic8/dotfiles that referenced this pull request Jul 22, 2026
Adds pingdotgg/t3code#4271 (keyboard-select composer controls + hold-modifier
hints) as the final entry in the applyPatches stack. The raw cumulative diff
applies with fuzz after #4258 and #4260, so it uses a plain fetchurl GitHub
link rather than a local compatibility patch.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment thread apps/web/src/components/BranchToolbarBranchSelector.tsx
colonelpanic8 added a commit to colonelpanic8/dotfiles that referenced this pull request Jul 22, 2026
Bump the pingdotgg/t3code#4271 fetchurl hash to the current PR head
(51135b2cc), pulling in the Cursor/Macroscope review fixes (terminal-focus
aware hints, layout-scoped picker open state, mutually-exclusive toolbar
pickers, branch-search reset). Raw cumulative diff still applies with fuzz.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@colonelpanic8
colonelpanic8 force-pushed the t3code/composer-keyboard-shortcuts branch from 51135b2 to dd6cfa5 Compare July 22, 2026 14:47
Comment thread apps/web/src/components/BranchToolbarBranchSelector.tsx Outdated
Comment thread apps/web/src/components/BranchToolbar.tsx
@colonelpanic8
colonelpanic8 force-pushed the t3code/composer-keyboard-shortcuts branch from 5c9615f to a371312 Compare July 22, 2026 15:45
Comment thread apps/web/src/components/BranchToolbar.tsx Outdated
@colonelpanic8
colonelpanic8 force-pushed the t3code/composer-keyboard-shortcuts branch from 8ebc09a to c2702bb Compare July 22, 2026 16:15
Comment thread apps/web/src/keybindings.ts
Comment thread apps/web/src/components/chat/ChatComposer.tsx
Comment thread apps/web/src/components/chat/composerProviderState.tsx
colonelpanic8 and others added 9 commits July 22, 2026 16:39
Make every selector in the thread first-prompt composer keyboard-operable
through the existing customizable keybindings system, alongside the
pre-existing modelPicker.toggle command:

- modelOptionsPicker.toggle (mod+shift+e): reasoning effort / traits menu
- runtimeModePicker.toggle (mod+shift+a): access level select
- planMode.toggle          (mod+shift+p): Plan/Build toggle
- environmentPicker.toggle (mod+shift+v): branch toolbar environment
- envModePicker.toggle      (mod+shift+l): local vs worktree
- branchPicker.toggle       (mod+shift+b): branch selector

All six are rebindable in Settings -> Keybindings (labels derived by the
existing commandLabel helper) and are upserted into existing configs by the
server's startup sync. Holding the platform mod key reveals Kbd hint badges
on each control via shouldShowComposerControlHintsForModifiers, which uses
subset (not exact) modifier matching so a bare Ctrl/Cmd reveals the chords.

Compact footer routes the effort/runtime toggles to CompactComposerControlsMenu;
mobile routes environment/env-mode to the combined run-context menu. Toggles
report availability so unavailable controls leave the browser default intact.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The hold-modifier hint chips were rendered inline inside the composer
control triggers, crowding out the current values (the model name
truncated to almost nothing). Render them instead as detached, portaled
tooltips anchored below each trigger, so the model, options, approval
and runtime-mode values stay fully visible while hints are shown. The
branch toolbar keeps its inline hints since those labels have room.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@colonelpanic8
colonelpanic8 force-pushed the t3code/composer-keyboard-shortcuts branch from d0c50d2 to 3a03660 Compare July 22, 2026 23:41

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

Reviewed by Cursor Bugbot for commit 3a03660. Configure here.

Comment thread apps/web/src/components/chat/ChatComposer.tsx
@colonelpanic8
colonelpanic8 force-pushed the t3code/composer-keyboard-shortcuts branch from ac2c0ac to d5ca73b Compare July 23, 2026 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 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.

1 participant