Skip to content

fix(web): follow the live end when jumping to latest - #307

Merged
nixuuu merged 1 commit into
devfrom
fix/jump-to-latest-end
Nov 6, 2026
Merged

nixuuu merged 1 commit into
devfrom
fix/jump-to-latest-end

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 6, 2026

Copy link
Copy Markdown
Member

Jump to latest can leave the reader above the end when the composer expands or virtual rows change height during navigation.

Cause and fix

The old jump took one native smooth-scroll target before the new layout settled. settle() ignored corrections for a 1 s lease, and only scrollend explicitly completed navigation. If the browser cancels that scroll without the completion event, the last measurement can be swallowed by the lease; its expiry schedules no correction. This leaves stuck = true while the actual scroll position is short of the end. Ordinary isolated idle cases reached the bottom; the exact natural sequence on the reported nightly remains unconfirmed. The cancelled-scroll/missing-event path below is reproducible with fault injection.

Replace end navigation with a frame-driven animation using existing motion tokens. Each frame reads the current end, every write is attributed to the feed, and completion calls the normal end settlement directly. Reader gestures, row navigation and fold anchoring cancel it. Far jumps and reduced motion retain the instant path. Track the actual derived footer reservation in the post-DOM correction effect, including the delayed footer-height commit. Extract unchanged keyboard targeting helpers to keep the component within the size limit; document the behavior in Polish.

Browser evidence

Used the isolated long-thread route with production feed/composer/state logic, 120 variable-height turns loaded tail-first (24 initially), older pages through view.history.load(), work folds/tool groups, markdown tables/code blocks, real composer compaction, draft/empty states, queue and secret panels. Temporary fixture changes and traces are excluded from the commit.

Sampled scrollHeight - scrollTop - clientHeight about every 100 ms for 2 s. For a 1000 px start, explicitly cancel native scrolling at 350 ms and suppress scrollend:

Approx. time (ms) Before gap (px) After gap (px)
0 1000 1000
100 910.5 304
200 518 56
300 235 3.5
400 145 0
500–2000 145 0
  • Desktop 1440 px and phone 390 px: 1, 3 and 6 turns up, plus near smooth jumps and far instant jumps, compact/expanded composer, empty/draft. All finish at the native end position; raw values are 0–0.5 CSS px from fractional scroll geometry, matching normal stream following.
  • Visible live-answer growth checked separately: near/far jumps on both widths finish at the same end. Scrolling up during streaming preserves the measured row with 0 px displacement on both widths. History prepend (24 → 48 turns) moves the anchor by less than 0.21 px. Opening work/tool folds keeps the header at 0 px displacement; keyboard paging and interrupting a jump keep reader control.
  • Simulated reduced motion takes the instant path. A footer growing from 211 to 423 px at 650 ms, after the jump completed, retains a 0 px gap through 2 s.

Preview limitations: its container-scroll action emits trusted scroll events but no wheel event, so gesture attribution also used a dispatched wheel event. CPU throttling and native reduced-motion emulation were unavailable. Reduced motion was simulated through the media query and disabled CSS transitions. This checks the shared web UI in Chromium; an Electron binary and the user's exact browser build were unavailable.

Validation

Passed: bun install, bun run gen:check, bun run typecheck, bun run lint, bun run format:check, bun run check:tmp, and the web build. The full run processed 1,717 tests across 280 files with 0 failures (158 opt-in/skipped tests) and no test temp directories left behind. Test temp data stayed inside the worktree, with Git parent discovery bounded at that directory so plain-folder fixtures do not inherit the repository origin. No UI/component tests added.

Copy audit (docs/copy.md §8): no UI text changed.

Related: #302 (tail-first history coverage; not identified as the introducing change).

Track the current end during animation and settle directly on completion. Follow footer reservation changes after DOM updates and preserve reader cancellation.

Related: #302
@nixuuu
nixuuu merged commit 587b046 into dev Nov 6, 2026
15 of 17 checks passed
@nixuuu
nixuuu deleted the fix/jump-to-latest-end branch November 6, 2026 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant