You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a choice-only question renders while focus is in the composer editor, focus drops to <body>, so Tab skips the question panel to the model picker below. TipTap sets contenteditable="false" (tabIndex = -1), not :disabled, so recover() returned early.
Change
Add workspaceUnavailable?: boolean to ComposerPromptEditorTiptap.tsx to set data-workspace-unavailable="true" on the editor, and pass workspaceUnavailable={isChoiceOnlyPendingQuestion} in ChatComposer.tsx. useLayoutEffect writes the attribute before editor.setEditable(false), so workspaceFocus.ts recovers focus to the composer's first usable control (the question header) while leaving dictation, responding, and project-selection freezes untouched.
Scope
Small keyboard-focus bug fix (no issue needed). Web composer prop, call site, and one browser test; desktop shares the bundle, mobile is native.
Verification
Repro (Linux):
Focus composer; type and delete a character.
Run window.t3dev.replay("question").
Check focus, then press Tab.
Setup: Linux (Chromium), dark theme, 1280×800, fresh isolated data per commit.
Steps: Keyboard input in composer → window.t3dev.replay("question") → wait for question → Tab.
Desktop: shares web bundle unchanged, not launched separately.
Automated checks and controls
ChatView.browser.test.tsx (choice-only pending question keeps keyboard focus in the composer): fails on base 758f73a7103c (received <body>), passes on 65f4b3a7fed6.
vp run check:changed 758f73a7103c: pass (format, lint, knip, typecheck, test 3 files / 150 tests, react compiler).
After captures were taken on equal production tree a6284b20dcba (only an extra test file was removed between a6284b20dcba and 65f4b3a7fed6; production files and ChatView.browser.test.tsx are byte-identical).
Controls identical on base and equal production tree a6284b20dcba: digit 1 selects option 1; submitting returns focus to the composer editor; sidebar, right details panel, open Settings dialog, and unfocused tab (document.hasFocus() === false) remain untouched.
Macroscope's review found this PR approvable — Choice-only questions now exclude the disabled text editor from workspace focus targeting, allowing focus to remain on usable composer controls. The change is confined to keyboard navigation and leaves other editor states unchanged.
You can add or adjust custom eligibility rules. Learn more.
Reviewing files that changed from the base of the PR and between 65f4b3a and a096e1b.
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
No actionable comments were generated in the recent review.
Walkthrough
The chat composer now passes choice-only pending-question state to the prompt editor. The editor exposes that state through a data attribute. A browser test checks that the expanded pending-user-input toggle receives focus when a choice-only question appears.
Changes: Choice-only pending question
Layer / File(s)
Summary
Propagate choice-only state to the editor apps/web/src/components/chat/ChatComposer.tsx, apps/web/src/components/ComposerPromptEditorTiptap.tsx, apps/web/src/components/ChatView.browser.test.tsx
ChatComposer passes whether the active pending question allows custom answers. The editor defaults workspaceUnavailable to false and sets data-workspace-unavailable="true" when the flag is true. The browser test checks focus on the expanded pending-user-input toggle for a choice-only question.
This change keeps keyboard focus inside the composer when a choice-only question appears. It is narrowly scoped, has a browser test for the focus behavior, and shows no remaining merge-blocking risk.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "fix(web): choice-only questions keep keyboard focus in the composer" names the main change. The diff adds a workspaceUnavailable prop to the composer editor and passes it from ChatComposer …
Description check
The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section explains the focus drop to body and why recover() returned early. The Change section…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "fix(web): choice-only questions keep keyboard focus in the composer" names the main change. The diff adds a workspaceUnavailable prop to the composer editor and passes it from ChatComposer for choice-only pending questions, so focus recovery moves to the question header instead of dropping to body. The title is a conventional commit with a clear scope and a specific subject, and it matches the browser test and the focus-recovery fix in the objectives.
Full details: Description check
Explanation
The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section explains the focus drop to body and why recover() returned early. The Change section explains the new prop, the data attribute, and the ChatComposer call site. The Scope section states that this is a small keyboard-focus bug fix and gives the reason no issue is linked. The Verification section gives repro steps, a before/after table with screenshots, the browser test result, and checks that were not run (custom-answer, mobile, desktop). The description does not name the model and harness used, which the template asks for when an agent was used. The description says it was generated with Gemini 4 Neon, so that line is missing a harness detail, but the main required sections are present and specific.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Environment: real web dev app, Chromium, Linux, 1280×800, light theme; fresh isolated database and identical synthetic Replay data on both commits.
On each commit, seed a synthetic project and completed Replay thread, open it directly, click the composer, type x and press Backspace, run window.t3dev.replay("question"), wait for the choice-only question and read-only composer, capture focus, press Tab, and capture focus again.
Scenario: Choice-only question retains keyboard focus and Tab reaches its first answer
Observed: base loses visible focus and Tab goes to the sidebar snooze control; head focuses the Fixture header and Tab reaches Strict schemas (Recommended).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:XS0-9 changed lines (additions + deletions).vouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a choice-only question renders while focus is in the composer editor, focus drops to
<body>, soTabskips the question panel to the model picker below. TipTap setscontenteditable="false"(tabIndex = -1), not:disabled, sorecover()returned early.Change
Add
workspaceUnavailable?: booleantoComposerPromptEditorTiptap.tsxto setdata-workspace-unavailable="true"on the editor, and passworkspaceUnavailable={isChoiceOnlyPendingQuestion}inChatComposer.tsx.useLayoutEffectwrites the attribute beforeeditor.setEditable(false), soworkspaceFocus.tsrecovers focus to the composer's first usable control (the question header) while leaving dictation, responding, and project-selection freezes untouched.Scope
Small keyboard-focus bug fix (no issue needed). Web composer prop, call site, and one browser test; desktop shares the bundle, mobile is native.
Verification
Repro (Linux):
window.t3dev.replay("question").Tab.Setup: Linux (Chromium), dark theme, 1280×800, fresh isolated data per commit.
Steps: Keyboard input in composer →
window.t3dev.replay("question")→ wait for question →Tab.758f73a7103c)65f4b3a7fed6)Focus dropped to body; no focus ring.
Focus ring on Fixture question header.
Tab skips panel to Question model picker.
Tab focuses first answer option in panel.
Not shown:
Replay (dev)recording emitsallowCustomAnswer !== false.contenteditable.Automated checks and controls
choice-only pending question keeps keyboard focus in the composer): fails on base758f73a7103c(received<body>), passes on65f4b3a7fed6.ChatView.browser.test.tsx(2 parallel loops × 100 runs, 200/200 passed, 0 failures).vp run check:changed 758f73a7103c: pass (format,lint,knip,typecheck,test3 files / 150 tests,react compiler).a6284b20dcba(only an extra test file was removed betweena6284b20dcbaand65f4b3a7fed6; production files andChatView.browser.test.tsxare byte-identical).a6284b20dcba: digit1selects option 1; submitting returns focus to the composer editor; sidebar, right details panel, open Settings dialog, and unfocused tab (document.hasFocus() === false) remain untouched.Generated with Gemini 4 Neon in T3 Code Nightly