Skip to content

fix(core): land a List's jump past rows changed above the viewport - #1027

Open
iFwu wants to merge 1 commit into
nsgo-dev:mainfrom
iFwu:fix/list-jump-past-changed-rows
Open

iFwu wants to merge 1 commit into
nsgo-dev:mainfrom
iFwu:fix/list-jump-past-changed-rows

Conversation

@iFwu

@iFwu iFwu commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #1019.

A scroll to a row (Ref.ScrollToIndex, Ref.ScrollToIndexAt) or to the end (Ref.ScrollToEnd), asked in the same update as rows inserted, removed or measured above the viewport, landed off its target by those rows. updateList added what they moved into anchor, and the anchoring ItemScrollBy went out after the jump's ItemScrollTo, so the platform applied both. The jump sets the offset outright from the new sizes, so it now drops the anchor, as it already drops a pending retarget.

  • core/list.go: the scroll commands reset anchor along with retarget.
  • core/list_test.go: TestKeyedListJumpsToARowInsertedAboveTheViewport inserts a row above the viewport and jumps to it in one update, animated and not. It fails on main with the inserted row is -40 from the viewport's start, want 0 and offset 840, want 800.
  • CHANGELOG.md: an Unreleased line.

Targets

  • Shared code (core, base, ui, tsx, the nsgo tool)
  • macOS
  • iOS
  • tvOS
  • watchOS
  • Android
  • Windows
  • Linux
  • Web
  • Mini programs
  • Docs or website only

Screenshots

None.

Verification

  • go tool nsgo test -run '^TestKeyedListJumpsToARowInsertedAboveTheViewport$' ./core fails on main at 4b3a9f7c and passes with this change, three runs out of three.
  • go tool nsgo check on Linux x86_64 (the host): passes.
  • go tool nsgo test on Linux x86_64 under Xvfb (GDK_BACKEND=x11, GSK_RENDERER=cairo, a private D-Bus session and a temporary HOME): 3,075 passed, 8 failed, 59 skipped. Main at 4b3a9f7c in the same environment: 3,074 passed, with the same 8 failing.
    • TestAccessibilitySelectedAndExpandedReachATSPI: no AT-SPI registry.
    • TestVideoShowsWhatIsBehindItsTransparentPixels: no GStreamer plug-in for the alpha video.
    • Six TestInstance*: the run's long TMPDIR pushed their socket paths past the address limit. All six pass three times out of three with a short one.
  • The same change on v0.2.0 has shipped in a macOS desktop app (Apple M3, macOS 27.2.1) since 2026-11-20.
  • Not run: -target tests, as nothing here is backend-specific; Windows, web and Apple's mobile targets.

Checklist

  • The title is a Conventional Commit, such as fix(linux): keep the caret after a paste; a squash merge uses it as the commit subject.
  • Docs whose facts change are updated, and CHANGELOG.md's Unreleased has a line for a capability users can see.
  • New third-party code, assets and dependencies name their source and license.

A scroll to a row or to the end, asked in the same update as rows inserted, removed or measured above the viewport, landed shifted by those rows: updateList added what they moved into anchor, and the anchoring ItemScrollBy went out after the jump's ItemScrollTo, so the platform applied both. The jump sets the offset outright from the new sizes, so it now drops the anchor, as it already drops a pending retarget.

Fixes nsgo-dev#1019
@github-actions github-actions Bot added documentation Improvements or additions to documentation core bug Something isn't working size/S labels Nov 20, 2026
@github-actions github-actions Bot added the conflict Conflicts with the base branch; resolve it first label Nov 20, 2026

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

bug Something isn't working conflict Conflicts with the base branch; resolve it first core documentation Improvements or additions to documentation size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

core: a List's jump to a row lands off by what changed above the viewport in the same update

1 participant