Skip to content

fix: count a script's scroll of the page as the reader's once the page has grown - #7534

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-7530
Nov 28, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-7530

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Switching an lf-shot from Slider to Pair took the page back to its top when the page had been scrolled by a script. The cause is in the runtime's scroll bookkeeping, not in the shot. dom/scrolling.ts decides whether a scroll was the reader's choice or layout's move by comparing the page's extent with the last one it recorded, and it watched only the root element for changes. The root stands the window's height (900 px in the test, while the body is 1517 px), so its size never changed as content grew, and the recorded extent stayed at the page's arrival size. After that, every single-jump scroll of the page, such as the test's scrollIntoView, read as layout's, so no choice was recorded. The next reading-region shift then restored the place the page arrived with, its top.

#7373 didn't introduce this bug, it exposed it. It made a slider frame the picture's width (600 px) where a Pair frame keeps its ring (602 px), so a view switch now changes the width of the frames' reading regions and announces a shift. Before #7373 both frames were 602 px, so the switch shifted nothing. #7373's sizing stays as it is.

The page's children are now watched for size the same way a scrolling box's children already are, so the page's extent follows its content. A wheel scroll was never affected, because a wheel is recorded as the reader's input either way.

Verification:

  • tests/journeys/test_render_controls.py::test_each_control_archetype_holds_its_neighbours_still[shot-view] fails on main (6313a6f59), with the radios moved by 617 px, and passes with the change. The archetype test's other four cases also pass.
  • pnpm run test:runtime passes (1237 tests).
  • 521 browser tests in test_render_shift_watch.py and the two test_reading_place.py files, selected with -k "clamp or script or anchor or shift or layout", pass.

Closes #7530 — automated triage

…e has grown

The page's scroll watch observed only the root element, whose box stands the
window's height while the content grows past it, so the page's recorded extent
stayed at its arrival size. Every later single-jump scroll of the page, such as
a script's scrollIntoView, then read as a layout move rather than a choice, and
the next region shift restored the place the page arrived with. Since #7373 a
lf-shot view switch changes its frames' width, which shifts their reading
regions, so switching from Slider to Pair took the page back to its top.

The page's children are now watched as a box's are, so its extent follows its
content. test_each_control_archetype_holds_its_neighbours_still[shot-view]
fails before and passes after.

Closes #7530
@leaf-agent
leaf-agent merged commit 3e87e6f into main Nov 28, 2026
8 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-7530 branch November 28, 2026 17:33
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.

test_each_control_archetype_holds_its_neighbours_still[shot-view]: pressing a view moves lf-shot's view radios 617 px since #7373

1 participant