Skip to content

fix(web): question option badges can be picked from the answer box - #37353

Open
mvanhorn wants to merge 1 commit into
pingdotgg:mainfrom
mvanhorn:feat/pending-input-option-shortcut-in-composer
Open

mvanhorn wants to merge 1 commit into
pingdotgg:mainfrom
mvanhorn:feat/pending-input-option-shortcut-in-composer

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem

When an agent asks a question, each option shows a number badge (1, 2, 3...) and focus starts in the composer ("Type your own answer, or leave this blank to use the selected option"). The digit shortcut ignores keys from the editor, so pressing 1 types "1" into the answer instead of picking option 1. Tab moves focus to the model picker trigger, which the shortcut also ignores, so with the default focus there is no keyboard path to the option the badge points at.

Repro: have an agent call AskUserQuestion, then press 1 without clicking anywhere. Expected: option 1 is picked. Actual: "1" appears in the composer.

Change

In ComposerPendingUserInputPanel, a keydown from the composer editor picks option N on Option+N, and also on Control+N on macOS. The digit comes from event.code because Option rewrites event.key on macOS (Option+1 gives "¡"). Bare digits still type in the answer box, and Mod+N (Cmd on macOS, Ctrl elsewhere) is left for thread.jump.N. Behavior outside the editor is unchanged.

Scope

Fixes #37354. The number badges point to a key that does nothing in the focus state the panel opens with.

Before (pressing 1 types into the answer box):

before

Verification

  • Added browser tests in ComposerPendingUserInputPanel.browser.test.tsx with focus in a composer-editor element: Option+1 toggles option 1. Bare 1, Cmd+1, Option+Shift+1 and Option+2 (no second option) do not. Option+1 leaves the editor empty.
  • With the source change reverted, the Option+1 case fails. With it, all 18 tests in the three ComposerPendingUserInputPanel browser test files pass.
  • vp check (lint and format) is clean on both files, and apps/web typecheck passes.
  • Not checked: Control+N on macOS in the packaged app. The tests run in Chromium and cover Option only.

There's no after screenshot because nothing visual changes. The fix is keyboard-only.

Written with Claude Opus 5.5 in Claude Code.

🤖 Generated with Claude Code

Focus starts in the composer when an agent asks a question, and the 1-9
option shortcuts ignore keys typed into the editor, so pressing the
digit shown on a badge typed it into the answer instead. Option+digit
(and Control+digit on macOS) now picks the option from the answer box.
Bare digits still type there, and Mod+digit still jumps threads.
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 15, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 90024fe

Macroscope's review found this PR approvable — Adds modifier-digit shortcuts to select question options while focus remains in the answer box. Existing question-availability safeguards and option-selection behavior remain in place, limiting the change to a bounded keyboard interaction.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The pending-question panel now supports Option+digit shortcuts in the answer box on all platforms and Control+digit on macOS. It rejects unsupported modifier combinations and keeps existing unmodified-digit selection behavior outside the answer box.

Changes: Answer-box shortcuts

Layer / File(s) Summary
Parse answer-box shortcut keys
apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx
The new parser accepts Option without Control on any platform, or Control without Option on macOS. It rejects Meta and Shift, and recognizes Digit1–Digit9 and Numpad1–Numpad9.
Handle shortcuts and verify selection
apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx, apps/web/src/components/chat/ComposerPendingUserInputPanel.browser.test.tsx
The key handler uses the parser when focus is in the answer box. Browser tests check Alt+1, plain 1, Meta+1, Alt+Shift+1, and Alt+2; only Alt+1 toggles the option, and the answer box remains empty.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

  • pingdotgg/t3code#28388: Changes digit-key handling in the same panel and adds browser tests for that behavior.
  • pingdotgg/t3code#34290: Changes number-key handling for pending questions and adds or updates browser tests for the digit-to-option behavior.

Suggested labels: bugfix

Suggested reviewers: only21mil, macroscopeapp

Merge Risk: Minimal · up to 90024

This adds Option+digit and, on macOS, Control+digit shortcuts to pick question options from the answer box. Behavior outside the answer box is unchanged. The change is narrow and tested, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: digit shortcuts from the composer answer box can now pick question options. It follows the conventional commit form and fits the summarized handler change and the adde…
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.
Description check Passed The description follows the template's main sections: Problem, Change, Scope, and Verification. It explains the bug (digit badges type into the composer instead of picking the option), the fix (Option…
Full details: Title check

Explanation

The title names the main change: digit shortcuts from the composer answer box can now pick question options. It follows the conventional commit form and fits the summarized handler change and the added browser tests.

Full details: Description check

Explanation

The description follows the template's main sections: Problem, Change, Scope, and Verification. It explains the bug (digit badges type into the composer instead of picking the option), the fix (Option+N and Control+N on macOS, digit read from event.code), and the scope (fixes #37354, with a before screenshot). Verification lists browser tests, a revert check, lint/format and typecheck results, and what was not checked (Control+N on macOS in the packaged app). The author also notes that no after screenshot is needed because the change is keyboard-only. The title is not in the description, but the template's title guidance is a comment, and the PR objectives show a conventional-style title. Minor gaps: the Scope section cites an issue but the template asks for a link to the issue that shows the bug, and the description gives the issue number without a full link. The Verification section does not describe a before/after recording, but the change is keyboard-only with no visual change.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between b732621 and 90024fe.

Files selected for processing: 2

  • apps/web/src/components/chat/ComposerPendingUserInputPanel.browser.test.tsx
  • apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

This branch has not been deployed

No deployments
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 Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Question option number badges can't be used from the keyboard; pressing 1 types into the answer box

1 participant