Repository navigation
test(SnapPaging): a held row's stops hold through a retarget - #10927
Conversation
A resize that renumbered a children pager's pages mid-settle left the settle on its old index, which then named another page: a row of three per view narrowed mid-settle ran back to the page it had left. A resize mid-settle also ended the settle at once, with a jump to the new page. When the spacings between pages all scale by one ratio, as when items or uniform pages follow the row's width, each page keeps its number and the settle keeps its fraction of a page. Otherwise the settle retargets by offset and plays on from where the track shows, at its velocity. A settle toward the last page ends on the last page, a target halfway between two pages goes on the way the settle moves, and the page last at rest keeps its place too. The retarget reads the track before the pages are measured, as measuring a held row can end its curves, and starts the new curve at that read's time. A release's waiting report still goes out two frames after the new settle starts, and a finger's waiting catch still catches it. A new writing direction mirrors the track, so a settle in flight then stops and re-places on its target's offset, as does a track the resize leaves past its new last page. A finished settle rests exactly on its curve's end.
A row of three per view settling onto its second view is narrowed by 30 px once two frames show the settle. In both directions, the retargeted settle must end on the view's layout stop: within 0.002 px, plus, in WebKit, the settle's speed times the gap between the stop item's rect and style reads. Without the held row's stop and span fix, the settle misses its stop in both engines.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis Report🔎 Preview ·
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
This pull request needs an engineering owner's spec decision before it can be approved, and two changes are required either way.
Approval waits on the spec:AST-094 FR6 resize rule this diff carries from #10592. The rule says a resize during a pager settle retargets it; pages that scale with the row keep the page and its fraction; otherwise a settle toward the last page ends there, and any other ends on the page nearest its target's offset, a tie going the way it moves. It also adds an FR6 gap and an "FR6 resize" verification row. An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner.
Required changes:
- The changeset says a resize mid-settle "no longer stops at once", but a resize that leaves the row past its new last page still lands it at once, as this pull request's own tests assert. Reword it, for example: "…no longer runs back to an earlier page and, unless the resize leaves it past its new last page, no longer stops at once."
- The diff has 2,105 authored changed lines, and 1,917 of them are #10592's commit. Add
Stack: #10592 → #10927to both descriptions, or land #10592 first and rebase so only the browser case remains.
The new unit cases fail on main and pass here. A narrowed three-per-view row now ends at its new end instead of running back. CI has not run on this draft head yet.
[Automated review]
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet, because the pull request is a draft on a fork branch. Once it is marked ready for review, a maintainer adds the ci:run label so CI runs.
The new case checks the current FR6 resize rule and passes 10 of 10 in Chromium, ending 0.00075 px from the stop, and it fails against each of the three held-stop mutants in the directions it covers.
- Miss (non-blocking): WebKit's tolerance (
speed * pairGap, with the gap capped at one frame) can reach about 3.4 px at this settle's speed, more than the 2.0 px and 2.9 px misses two of the mutants produce, so consider capping the gap well under a frame, or dropping the allowance now that the held stop reads its translate on both sides of the rect.
Claims and files checked
Review mode: full; reason: spec-record
- Claim: the pager fix has landed, so the diff holds only the test. Verified: one test file, 188 added lines.
- Claim: no browser case guarded a held row's stops through a resize retarget. Verified: the other resize and held-finger cases cover other paths.
- Claim: without the held-stop fix the settle misses its stop. Verified at this head in Chromium with three one-line mutants (misses of 2.0 to 104 px); the author's pre-fix arm was not rerun.
- Claim: the case was split from the pager pull request to keep it under 2,000 lines. Consistent with the branch history.
- Claim: the case checks the FR6 resize rule with Carousel FR7's stops. Verified against both clauses.
- Claim: one case, run in both directions. Verified.
- Claim: a 70% drag with a still lift settles the three-up row onto its second view. Verified in the case and its runs.
- Claim: the row narrows by 30 px once two frames show the settle. Verified.
- Claim: the new settle's last keyframe sits within 0.002 px of the stop. Verified: 0.00075 px measured.
- Claim: WebKit adds the settle's speed times the rect-to-style read gap, and a gap over a frame fails by name. Verified in the code; see the note on its size.
- Claim: a page that shows the whole settle before the narrowing fails by name. Verified.
- Claim: no product, CI, public API or internal-context change. Verified.
- Claim: this head passes 10 of 10 per engine. Verified in Chromium; WebKit not reproduced.
- Claim: the whole spec passes, Chromium 50 with 5 skips and WebKit 55. Verified in Chromium (50 passed, 5 skipped); WebKit not reproduced.
- Claim: the mutants fail (two in both engines, the right-to-left one only right to left). Verified at this head in Chromium; WebKit not reproduced.
- Claim: runs on earlier builds, under busy loops and at 16 WebKit workers. Author-run; not reproduced.
- File:
packages/core/src/SnapPaging/__tests__/SnapPaging.interaction.browser.spec.ts: clear, one non-blocking note.
| let bound = 0.002; | ||
| if (browserName === 'webkit') { | ||
| expect( | ||
| pairGap, | ||
| "the stop's item's rect and style reads lie within a frame (ms)", | ||
| ).toBeLessThanOrEqual(1000 / 60); | ||
| bound += speed * pairGap; |
There was a problem hiding this comment.
Non-blocking: with pairGap capped at one frame, this WebKit bound can reach about 3.4 px at the settle's measured 0.204 px/ms. That is more than the 2.0 px and 2.9 px misses that the held-stops-keep-the-translate and right-to-left-backward mutants produce at this head in Chromium. The pager's heldRead now reads the translate on both sides of the rect and reads again when they differ, so a split read no longer reaches the stop. Consider capping the gap well under a frame (for example 2 ms), or dropping the allowance if WebKit holds 0.002 px without it, and updating the comment above.
The pager fix landed in #10592, so after this merge of main this pull request holds only its test.
Maintainer impact
Nothing in the browser guards the held row's stop and span fix where it shows. It shows in a row that resizes while the paging holds it, and settles on. Without that fix, the settle misses its stop in both engines. This case moved here from #10592 to keep that pull request under 2,000 lines. It needs #10592's retarget, so it rebases to this case alone once #10592 merges. Until then, this pull request's diff also shows #10592's commit; review the top commit.
Intended invariant
spec:AST-094FR6's resize rule, withcomponent:CarouselFR7: a held row's retargeted settle ends on its view's layout stop.Change
One browser case, run in both directions. A drag of 70% of a view and a still lift settle a row of three per view onto its second view. Once two frames show the settle, the page narrows the row by 30 px. The new settle's last keyframe must sit on the view's layout stop, within 0.002 px. Each WebKit run adds the settle's speed times the gap between the stop item's rect and style reads. WebKit resolves each read at its own time, and a gap over a frame fails by name. So does a page that shows the whole settle before the narrowing.
Evidence
Scope
Components: SnapPaging
Testing