Skip to content

fix(web): typing a citation comment no longer scrolls the page - #36194

Open
AkiVonAkira wants to merge 5 commits into
pingdotgg:mainfrom
AkiVonAkira:citation-comment-sticky-edge
Open

AkiVonAkira wants to merge 5 commits into
pingdotgg:mainfrom
AkiVonAkira:citation-comment-sticky-edge

Conversation

@AkiVonAkira

Copy link
Copy Markdown
Contributor

Problem

Cite text, scroll the timeline so the quote goes out of view, then type a comment: the whole app jumps. The comment box follows the quote off-screen, so the browser scrolls the page to the caret. Reported in #36193.

Change

The comment box now stays inside the visible part of the timeline, which runs from the timeline's top edge to the top of the composer floating over it.

  • The popup's anchor is clamped to that area, so a quote scrolled out of view pins the box to the edge it left by: just above the composer when you scrolled up, at the top of the timeline when you scrolled down. When the quote comes back into view, the box sits next to it again.
  • The same area is passed to Base UI as the collisionBoundary, so the box flips above the composer instead of covering it. The boundary uses getters because Floating UI reads it on every position update.
  • PopoverPopup passes collisionBoundary through to the positioner. When it's unset, Base UI's default applies, so existing callers don't change.

Typing never scrolls the timeline or the page. This differs from #34787, which scrolls the timeline back to the quote on each keystroke. The user scrolled away for a reason, often to reread something while writing the comment, so this PR keeps their scroll position.

Scope

Fixes #36193. One component, plus one pass-through prop on the shared popover. No contract, server, desktop, or mobile changes. The mobile app doesn't have this popover.

Verification

  • A new browser test in AssistantCitationChip.browser.test.tsx opens the box next to a visible quote, then scrolls the quote under a composer and past the top. On main it fails: the box bottom is at 893, below the composer top at 776. With the fix it passes, and typing leaves page and timeline scroll unchanged.
  • vp run check:changed passes (format, lint, knip, typecheck, tests, React Compiler).
  • Tested in the dev web app with Replay threads, real clicks and typing, at 1280×800 and 390×844. After scrolling the quote 2000px below the window, the box stayed at 551–665 with the composer top at 668. Page scroll stayed at 0 while typing.
  • Not checked: Safari, Firefox, or the packaged desktop app.
Before After
before after, scrolled up

Scrolled down past the quote, and at phone width:

after, scrolled down after, phone

Reviewed with sol-loop: 1 round with GPT-6.1 Sol. Sol verdict: approved.

Created with Claude Opus 5.5 in T3 Code. GPT-6.1 Terra searched for existing issues.

@github-actions github-actions Bot added the vouch:unvouched Author is not yet trusted in the VOUCHED list. label Nov 13, 2026
@github-actions github-actions Bot added the size:M 30-99 changed lines (additions + deletions). label Nov 13, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at f576073

Macroscope's review found this PR approvable — Citation-comment popovers now stay within the visible timeline when their source quote scrolls offscreen. The change is limited to positioning, with no changes to comment storage or sending behavior.

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

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 13, 2026
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The citation comment popup stays within the visible timeline area above the composer when its source quote scrolls out of view. Browser tests check popup placement and verify that typing does not change document or timeline scroll positions.

Changes: Citation popup positioning

Layer / File(s) Summary
Popover collision boundary
apps/web/src/components/ui/popover.tsx
PopoverPopup accepts an optional collision boundary and passes it to the positioner.
Visible timeline positioning and tests
apps/web/src/components/chat/AssistantCitationChip.tsx, apps/web/src/components/chat/AssistantCitationChip.browser.test.tsx
The citation popup clamps its anchor to the visible timeline area and uses that area as its collision boundary. Browser tests check popup placement as the quote scrolls and verify that typing does not change document or timeline scroll positions.

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

Change: Bug fix · Severity of issue fixed: Low

Possibly related PRs

  • pingdotgg/t3code#34787: Addresses the same citation-comment scrolling issue with a different approach that scrolls the timeline to the quote.

Suggested reviewers: juliusmarminge, maria-rcks

Merge Risk: Minimal · up to 678f2

This change keeps the citation comment box inside the visible timeline and stops typing from scrolling the page. It touches one component and one optional popover prop. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(web): typing a citation comment no longer scrolls the page" names the main change: the citation comment popup no longer scrolls the page while typing. The raw summary and objectives con…
Description check Passed The description follows the template's sections: Problem, Change, Scope, and Verification. The Problem section explains the bug and links #36193. The Change section explains the clamping and the colli…
Linked Issues check Passed The only active directly linked issue is #36193. Its coding requirements are: (1) typing in the citation comment box must not scroll the page or the timeline; (2) while the quote is out of view, the b…
Out of Scope Changes check Passed All changes connect to #36193.
- apps/web/src/components/chat/AssistantCitationChip.tsx: adds visibleTimelineRect, liveBoundary, the clamped popupAnchor, popupBoundary, and the `commentTrigger…
Full details: Title check

Explanation

The title "fix(web): typing a citation comment no longer scrolls the page" names the main change: the citation comment popup no longer scrolls the page while typing. The raw summary and objectives confirm the clamping of the popup anchor to the visible timeline area and the pass-through of collisionBoundary, which serve that goal. The title is concise, uses a conventional commit prefix, and is specific enough for a teammate scanning history.

Full details: Description check

Explanation

The description follows the template's sections: Problem, Change, Scope, and Verification. The Problem section explains the bug and links #36193. The Change section explains the clamping and the collisionBoundary pass-through, and it states that existing callers are unchanged. The Scope section names the single component and the shared popover prop, and it says no contract, server, desktop, or mobile changes were made. The Verification section gives a specific browser test, check results at both viewport sizes, and before/after evidence, and it lists what was not checked. The template's optional agent-model line is present. The description is complete enough to pass.

Full details: Linked Issues check

Explanation

The only active directly linked issue is #36193. Its coding requirements are: (1) typing in the citation comment box must not scroll the page or the timeline; (2) while the quote is out of view, the box stays inside the visible timeline: just above the composer when the quote is below, and at the timeline top when the quote is above; (3) the box sits beside the quote again when the quote is visible.

Code at the reviewed head (apps/web/src/components/chat/AssistantCitationChip.tsx) covers these as follows:

  • Requirement (2) and (3): visibleTimelineRect computes the area from the viewport top to the top of [data-chat-composer-stack="true"]. popupAnchor.getBoundingClientRect clamps the quote rect vertically to that area, so the anchor pins to the edge the quote left by, and returns to the quote when it is visible again.
  • Collision boundary: popupBoundary uses liveBoundary getters, passed as collisionBoundary. This keeps the box above the composer instead of covering it.
  • Requirement (1): initialFocus focuses the input with preventScroll: true. The popup stays inside the visible area, so the caret does not sit outside the viewport on typing. The new browser test asserts unchanged document and timeline scroll after typing. The PR description reports that this test passes and that manual checks at 1280×800 and 390×844 show no page scroll.

The manual checks (Safari, Firefox, packaged desktop app) are non-coding and do not apply.

Limits: the browser test was not executed in this assessment. The conclusion relies on the head source read and the reported verification. The popover.tsx diff was read directly. The AssistantCitationChip.tsx diff could not be read, but its head file was read in full up to the evidence limit.

Full details: Out of Scope Changes check

Explanation

All changes connect to #36193.

  • apps/web/src/components/chat/AssistantCitationChip.tsx: adds visibleTimelineRect, liveBoundary, the clamped popupAnchor, popupBoundary, and the commentTrigger state used to find the composer stack. These implement requirements (1) to (3).
  • apps/web/src/components/ui/popover.tsx (diff read directly): adds an optional collisionBoundary prop forwarded to the positioner. When unset, the Base UI default applies, so other callers keep their behavior.
  • The test file change (per the summary): an optional container argument for the mount helper and the new positioning and no-scroll test. This supports the verification of the requirements.

The PR summary reports no contract, server, desktop, or mobile changes, and no unrelated change appears in the read evidence.

Limits: the AssistantCitationChip.tsx diff and the test file diff were not read as diffs. The out-of-scope conclusion for those files relies on the head file content and the summary.

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 06b62c1 and 678f2e9.

Files selected for processing: 2

  • apps/web/src/components/chat/AssistantCitationChip.browser.test.tsx
  • apps/web/src/components/chat/AssistantCitationChip.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.

@juliusmarminge juliusmarminge added takeover:needs-julius Takeover done; route gate says Julius decides and removed takeover:in-progress A takeover lead is working on this PR labels Nov 13, 2026
…icky-edge

# Conflicts:
#	apps/web/src/components/chat/AssistantCitationChip.browser.test.tsx

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:M 30-99 changed lines (additions + deletions). takeover:needs-julius Takeover done; route gate says Julius decides 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]: Typing a citation comment after scrolling the quote away scrolls the whole page

2 participants