Repository navigation
fix: land each scroll glide on a whole pixel so u after d returns to the top - #6364
Merged
Merged
Conversation
A glide's goal and per-frame writes were fractional, and since #5806 setScroll skips any write within a pixel of where the box stands. When a page step measured, say, 159.7px, a late frame of `d`'s glide left the box at 160 and the final write to 159.7 was skipped; `u` pressed after that glide landed then headed for 0.3, a late frame left the box at 1, and the final write was skipped again, so the threads view stopped a pixel short of its top. That is the state the failing CI picture of test_keys_in_threads_act_on_threads shows, and why its wait for scrollTop === 0 timed out. glideTo now rounds its goal, keeping a goal at the end equal to scrollLimit, and rounds each frame's write, so the last write always lands the box on its goal. Behavior change: `d`/`u` and every glide end on a whole pixel. The new runtime test drives a glide's frames over a box that snaps to whole pixels and fails before the change with the box at 1. Refs #5883
This was referenced Nov 18, 2026
max-sixty
pushed a commit
that referenced
this pull request
Nov 18, 2026
#6364 rounds every scroll glide's goal to a whole pixel, and a press made during a glide adds its step to that rounded goal. `test_the_reading_keys_accumulate_and_reverse` still expected unrounded multiples of the step. With `d`'s step of 482.4 px, three presses rest at 482 → 964 → 1446, and the test wanted 1447.2 ± 1. It failed on main in push run [44269587200](https://github.com/max-sixty/leaf/actions/runs/44269587200) with `assert 1446 == 1447.1999999999998 ± 1`. Only the test changes. Each expected resting place now comes from the rule `glideTo` states: round the previous goal plus the step. The ±1 bound stays. What the test guards is unchanged. A second press that measured from a glide still in flight would rest hundreds of pixels short, and one that ignored the user's mid-glide scroll would miss 400 by a whole step. Rounding at each press drifts at most half a pixel per press, which no reader sees, so I kept #6364's rule rather than adding a separate unrounded aim to the glide. Verification: the test fails on main locally with the CI message and passes on this branch, together with `test_the_reading_page_step_never_paints_behind_where_it_started`. Refs #3985 — automated triage Co-authored-by: leaf-agent <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
glideToaimed at fractional positions, and since #5806setScrollskips any write that lands within a pixel of where the box already stands. So a glide could end a pixel off its goal: when a page of the threads view measures about 159.7px, a late frame ofd's glide leaves the box at 160, and the final write to 159.7 is skipped.u, pressed once that glide has landed, then aims for 0.3. A late frame leaves the box at 1, and the final write is skipped again. The view stops atscrollTop1, andtest_keys_in_threads_act_on_threadstimes out waiting forscrollTop === 0. #5806 landed the day before that test's first failure.The glide now rounds its goal and each frame's write to whole pixels, so its last write always moves the box onto the goal. A goal at the box's end stays exactly
scrollLimit, becausescrollToEndand the glide'sendflag compare against it (scrolling.js). Behavior change:d,uand every other glide end on a whole pixel.Verification:
tests/runtime/scrolling.test.mjsdrives a glide's frames over a box that snaps to whole pixels. It fails before the change (the box ends at 1) and passes after it.pnpm run test:runtimepasses.scrollTop1 far better than one at 0 (1,499 differing pixels against 11,477).d→ wait →uleft the view at 1 in 2 of 4 tries before the change and in 0 of 4 after it.This fixes only
test_keys_in_threads_act_on_threads. #5883's other intermittent tests, the diff sideways reader and the visual action'sLocator.focustimeout, have different mechanisms and stay open there.Refs #5883 — automated triage