fix(web): preserve scroll position when expanding work details#29166

merged1
main
t3/preserve-scroll-on-accordion
opened7d agobyYYash-Singh1
View on GitHubTwo-way sync enabledPR last imported 7d ago

Problem

Expanding the "Worked for" accordion while scrolled to the bottom forced the timeline to stay at the bottom. This moved the heading out of view instead of keeping the current position as the details opened.

Change

Remove the accordion-specific logic that repeatedly pinned the timeline to the bottom. Keep the clicked heading anchored while the expanded content settles. Streaming auto-scroll continues to use its existing logic.

Scope and approval

This is a focused fix for an obvious scroll position bug. The shared timeline change covers web and desktop. Mobile already keeps the clicked heading in place when the accordion opens.

Verification

Added a browser regression test that expands the accordion at the bottom of a populated timeline and checks that the heading stays in place while the viewport moves away from the bottom. All 38 timeline browser tests and vp run check:changed passed. Verified live in the isolated dev app with the free Replay provider. Expanding completed work preserved the heading and scroll offset. A subsequent streaming turn followed growing content and finished at the bottom, including in a shorter viewport. Recorded the streaming check locally.

Model: GPT 6.1 Sol. Harness: Codex.

Checks

25 successful · 13 skipped
All checks passed
a206518

Added 1 commit

  • fix(web): preserve scroll position when expanding work detailsa206518
Synced from GitHub

Approvability

Verdict: Approved at a206518

Macroscope's review found this PR approvable — Disclosure toggles now preserve the timeline’s anchored position instead of forcing a jump to the bottom. The change is limited to client-side scrolling and retains the existing temporary end-follow suspension.

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

Synced from GitHub

Review in Change Stack →

No actionable comments were generated in the recent review.

External image Recent review info
External image Run configuration
External image Commits

Reviewing files that changed from the base of the PR and between d01b92c0613936e5204ea2787a9ed6bf7d1ff547 and a206518dd2ad541ea436596f14b4e78a3207d9ac.

External image Files selected for processing: 2
  • apps/web/src/components/chat/MessagesTimeline.browser.test.tsx
  • apps/web/src/components/chat/MessagesTimeline.tsx

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

Walkthrough

Disclosure expansion in MessagesTimeline no longer restores end-pinned scrolling. The timeline retains the disclosure anchor while settling. A browser test checks that expanding long progress content keeps its heading at the same viewport position while increasing scroll height.

Changes: Timeline disclosure

Layer / File(s)Summary
Disclosure anchoring without end pinning
apps/web/src/components/chat/MessagesTimeline.tsx, apps/web/src/components/chat/MessagesTimeline.browser.test.tsx
Disclosure handling no longer detects or restores end-pinned scrolling. Visible-content restoration uses the disclosure anchor, and item-size changes reschedule settling when an anchor is active. The browser test checks the heading position, increased scroll height, and viewport position after expansion.

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

Change: Bug fix

Possibly related issues

  • pingdotgg/t3code#21967: The PR changes disclosure anchoring and visible-content restoration for expanded work content, which overlaps the issue’s described behavior.

Suggested reviewers: utkarshusername, t3dotgg, juliusmarminge

Merge Risk: External image Low · up to a2065

Expanding a long "Worked for" section now keeps the heading in place as intended. In some cases the scroll-to-bottom button may stay hidden until the next scroll. This is a narrow, self-correcting edge case that the owner should be aware of, and it is not a merge blocker.

Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check nameStatusExplanationResolution
Description checkWarningThe description includes all required sections and explains the problem, change, scope, tests, and observed behavior. It does not include the required before/after screenshots or an embedded/linkable …Embed clear before/after screenshots and link a short recording that demonstrates the accordion expansion and streaming scroll behavior. Clarify which live checks were completed and which could not be completed because the Browser panel was…
Passed Passed checks: 3 passed
Check nameStatusExplanation
Title checkPassedThe title clearly and concisely describes the main change: preserving the timeline scroll position when work details expand.
Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description includes all required sections and explains the problem, change, scope, tests, and observed behavior. It does not include the required before/after screenshots or an embedded/linkable recording for this UI interaction. The live verification claims also conflict with the stated limitation that the Browser panel was unavailable.

Resolution

Embed clear before/after screenshots and link a short recording that demonstrates the accordion expansion and streaming scroll behavior. Clarify which live checks were completed and which could not be completed because the Browser panel was unavailable.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Synced from GitHub

Note

Generated by GPT 6.1 Sol

CodeRabbit completed with no actionable comments. The live verification limitation in its description warning is outdated: the Browser panel was opened successfully, and the PR description now records the completed Replay checks. Streaming followed growing content and finished at the bottom, including after opening the accordion.

The possible scroll-to-bottom indicator delay is not a merge blocker. The existing content-size subscription calls handleScroll to refresh the end state, and the normal scroll handler does so as well. This change keeps those paths intact. All CI checks pass on a206518, Macroscope approved that commit, and there are no unresolved review threads.