fix(web): the Cite button comes back once the timeline stops scrolling #15818
main fromrefs/pull/15818/head·merged by juliusmarminge View on GitHubFixes #15700.
Scrolling an assistant text selection permanently dismissed Cite. Temporarily hide the toolbar during scrolling, then re-read the selection 150 ms after scrolling settles. Restore it at the current text anchor when selected text is visible. Escape remains dismissed until a new gesture; held selection drags and the terminal’s default context-menu behavior are preserved.
Only the assistant toolbar opts in. Visibility uses the shared intersection of the timeline and each selected text fragment’s clipping ancestors, including horizontal code scrolling and selections across blocks. It runs on selection reads and settled scrolling, using the observer’s existing timer.
Rebuilt from @Mnigos’s #15818, preserving contributor commits and merging main. Replaced ten added test cases with three combined behavioral cases; corrected independent-overlap and common-ancestor-only clipping checks.
Validation: 42 → 35 tests in apps/web/src/lib/selectionActions.test.ts, including all 32 main cases unchanged. All pass. Negative controls fail on missing scroll restoration, horizontal clipping, and disjoint clipping intersections. Targeted lint/format and web typecheck pass. Round one: Sol found no defects; Opus found a non-selectable code-header fragment could falsely restore Cite. Round two found navigation keys could undo Escape before a scroll; reproduced and fixed by separating restoration eligibility from the keyboard-selection latch. Both fixes have unit/live proof. The third full independent review round was clear on both Claude Opus 5.5 and GPT-6 Sol; both independently reran all 35 tests.
Linux browser verification used the same isolated synthetic timeline, 1280×800 viewport, selected text and scroll offsets for pinned main and the rebuilt head. Selection/pointer/key events were scripted; the DOM scrolls were real. Cite hides during scroll, returns at its new position after settling, stays hidden offscreen, and returns when the same selection comes back. Also verified horizontal code clipping and partial visibility, a selection spanning prose and clipped code (including a visible non-selectable header), Escape during a pending restore and later keyboard scrolling, real text reselection re-arming restoration, release after held-drag autoscroll, and the real Cite button inserting the expected quote into the composer. No message was sent.
Before — the selection remains but Cite does not return:

After — Cite returns at the current text position after scrolling settles:

Limits: physical mouse selection, trackpad momentum, live provider output, Electron native menus, macOS, Windows, Safari/Firefox, iOS, Android, and a second remote client were not run. Terminal compatibility is covered by the existing observer tests and unchanged default opt-in, not a live native-menu check. Collapsed-table-specific disjoint clipping and horizontal-only lane clipping have geometry/source evidence, not a live table fixture. Native mobile has no toolbar change. This takeover does not merge the PR.
Implementation and verification: GPT-6.1 Sol in the Codex harness through T3 Code; tests GPT-6 Astra; independent reviews Claude Opus 5.5 and GPT-6 Sol.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
Approvability#
Verdict: Approved at
102c3ddMacroscope's review found this PR approvable — This is a contained web bug fix that restores the existing Cite button after scrolling, with nested clipping and dismissal behavior handled in the assistant selection path only. The shared observer remains backward-compatible by default, and the new interaction cases are covered by focused tests.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
- Review profile: CHILL
- Plan: Advanced
- Run ID:
a2a46dd7-cb97-45e7-87cf-17cf7624a456
📥 Commits
-
Reviewing files that changed from the base of the PR and between fe417dff4cdc149d6873bb4fbaaa388731628d0b and 4a78be186a7c73cc52d35dbca6f4cc08f1f889e6.
📒 Files selected for processing (3)
-
apps/web/src/components/chat/AssistantSelectionToolbar.tsxapps/web/src/lib/selectionActions.test.tsapps/web/src/lib/selectionActions.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
-
📝 Walkthrough
-
Selection actions now support visibility checks against clipping bounds and optional restoration after scrolling settles. The assistant selection toolbar enables restoration and clears when the selected range is not visible.
Changes: Selection toolbar behavior
Layer / File(s) Summary Check selection visibility against clipping bounds
apps/web/src/lib/selectionActions.ts,apps/web/src/components/chat/AssistantSelectionToolbar.tsx,apps/web/src/lib/selectionActions.test.tsisSelectionRectVisiblerequires positive width and overlap with every clipping rectangle. The toolbar clears when the selection is outside the viewport or a clipping ancestor. Tests cover fully clipped, edge-touching, zero-width, and partially clipped selections.Restore selection actions after scrolling
apps/web/src/lib/selectionActions.ts,apps/web/src/components/chat/AssistantSelectionToolbar.tsx,apps/web/src/lib/selectionActions.test.tsobserveSelectionActionsaccepts an optionalrestoreAfterScrollsetting. When enabled, it schedules restoration after a 150 ms delay unless actions were dismissed. The toolbar enables this setting. Tests cover restoration, Escape dismissal, and teardown.Priority: ⬇️ Low
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix · Severity of issue fixed: Low
Suggested reviewers:
juliusmarminge
Merge Risk: ⚪ Minimal · up to
4a78b-
The Cite button now returns after the timeline stops scrolling, and the terminal drawer's behavior is unchanged. No merge-blocking issue was found.
Pre-merge checks:
4 · 1-
Failed checks: 1 warningCheck name Status Explanation Resolution Docstring Coverage Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold. Passed checks: 4 passed-
Check name Status Explanation Linked Issues check Issue #15700requires the Cite action to return after scrolling settles when the selected assistant text remains visible, stay hidden when it is out of view, and return when it becomes visible again. …Out of Scope Changes check All changes support issue #15700. The observer option limits the behavior change toAssistantSelectionToolbar; the visibility helper handles clipped selections exposed by restoration; and the tests …Title check The title clearly and concisely describes the main fix: restoring the Cite button after timeline scrolling stops. Description check The description explains the problem, implementation, scope, linked issue, verification results, screenshots, recordings, and untested limitations. It provides sufficient detail for review, although i… Full details: Linked Issues check
-
Explanation
Issue
#15700requires the Cite action to return after scrolling settles when the selected assistant text remains visible, stay hidden when it is out of view, and return when it becomes visible again.AssistantSelectionToolbaropts into restoration, andobserveSelectionActionsre-reads the selection 150 ms after the last scroll with no pointer. The toolbar rechecks the assistant selection and intersects its rectangle with the timeline and overflow-clipping ancestors. Added tests cover settled-scroll restoration, Escape dismissal, teardown, and visibility. The default behavior remains unchanged for other observer users.
Full details: Out of Scope Changes check
-
Explanation
All changes support issue
#15700. The observer option limits the behavior change toAssistantSelectionToolbar; the visibility helper handles clipped selections exposed by restoration; and the tests cover the new behavior. The diff does not change the terminal drawer.
Full details: Description check
-
Explanation
The description explains the problem, implementation, scope, linked issue, verification results, screenshots, recordings, and untested limitations. It provides sufficient detail for review, although it does not reproduce the template headings exactly and does not state explicit maintainer approval.
-
-
- Fix all pre-merge checks with AI
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
juliusmarminge added labelsmacroscope-review
juliusmarminge assignedjuliusmarminge
Taking over this one as maintainer for batch settings-theme-02. I will preserve your commits, merge current main, minimize the regression coverage, and verify the Cite selection behavior in an isolated client. I will leave it unmerged.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
juliusmarminge merged thiscd8c2c5
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed