Registry Mirror
Skip to content

Conversation

@only21mil

Copy link
Copy Markdown
Contributor

Problem

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):

  1. Focus composer; type and delete a character.
  2. Run window.t3dev.replay("question").
  3. 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.

Before (758f73a7103c) After (65f4b3a7fed6)
Focus dropped to body; no focus ring.
Focus dropped to body; no focus ring.
Focus ring on Fixture question header.
Focus ring on Fixture question header.
Tab skips panel to Question model picker.
Tab skips panel to Question model picker.
Tab focuses first answer option in panel.
Tab focuses first answer option in panel.

Not shown:

  • Custom-answer question: no checked-in Replay (dev) recording emits allowCustomAnswer !== false.
  • Mobile: native controls, no contenteditable.
  • 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.
  • Concurrent stress: ChatView.browser.test.tsx (2 parallel loops × 100 runs, 200/200 passed, 0 failures).
  • 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.

Generated with Gemini 4 Neon in T3 Code Nightly

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Dec 2, 2026
@macroscopeapp

macroscopeapp Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 65f4b3a

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.

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

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.

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

Change: Bug fix

Suggested reviewers: stienswout, juliusmarminge

Merge Risk: Minimal · previous review 65f4b

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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 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.
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
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 56d114d and 65f4b3a.

Files selected for processing: 3

  • apps/web/src/components/ChatView.browser.test.tsx
  • apps/web/src/components/ComposerPromptEditorTiptap.tsx
  • apps/web/src/components/chat/ChatComposer.tsx

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

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Dec 2, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

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

Proven: the scenario fails on base 8fc71a2eec and passes on head a096e1bbae.

Base 8fc71a2eec Head a096e1bbae
Result ❌ failed
ASSERTION_FAILED: expected false to be true
✅ passed
question header focus Base 8fc71a2eec: question header focus Head a096e1bbae: question header focus
first tab focus Base 8fc71a2eec: first tab focus Head a096e1bbae: first tab focus
failure Base 8fc71a2eec: failure
Recording Before After
Same keyboard flow Before video After video

Scenario source

Observed: base loses visible focus and Tab goes to the sidebar snooze control; head focuses the Fixture header and Tab reaches Strict schemas (Recommended).

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Dec 2, 2026
@juliusmarminge
juliusmarminge merged commit ae203ef into pingdotgg:main Dec 2, 2026
45 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 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.

2 participants