Repository navigation
fix(SnapPaging): a stop within half a step of the end is the end page - #10591
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC |
|---|---|---|
| Carousel | 68.4 kB (+116 B) · 10.8 kB CSS (0) | — |
Package size: @astryxdesign/core 6.94 MB packed (+2.1 kB); no new dependencies.
API changes: none in this pull request
Committed API report behind this build: cli 21 rows, core 39 rows; run pnpm api:report.
Not run on this PR: add ci:run-visual, ci:run-a11y or ci:run-rtl to run them.
Generated by PR Enrichment workflow | View full report
|
/approve-spec 6311fd2 |
There was a problem hiding this comment.
Changes requested: the end-page rule matches the owner-approved Split end rows and works for arrow keys and item-mode flicks in Chromium, but the native-snap skip goes stale when the row's items change.
- After an item is added, or items resize, without the row itself resizing, the skipped item keeps
scroll-snap-align: none, becauseskipruns only inmeasurePages(SnapPaging.ts:458-462). With an eighth item, ArrowRight from the fourth item then jumps to the sixth, and a Scroll right press settles on the fifth item and then jumps to the sixth. Please refresh the skip wherever fresh stops are read and when the children change, and add a test that adds an item.
Also worth a look: in headless Chromium the Shift + wheel case rests a full step back on main too, so an arrow-key case would pin the native-snap skip the changeset promises. FR7's first sentence could also name the new exception so that it agrees with the Split end row.
[Automated review]
6311fd2 to
e6139a8
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on the component:Carousel record changes at this head, and two code changes are needed.
This head writes the end-page exception into FR7's stop sentence and FR5 and adds the Split end and FR7 verification rows, and the earlier spec approval covered the previous head only. An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request (the author may do so as an engineering owner), approving the record as written or asking for the Review checks row and the FR5/FR6 and FR7 stories verification rows to name the exception too.
Blocking:
- When an item is added while the row settles, the hand-back scrolls and snaps before the catch-up rewrites the skip (
SnapPaging.ts:497-503), so an item-mode flick from item 4 lands on 514 instead of 411 and skips item 5; please write the due skip inside the hand-back beforescroll-snap-typecomes back, and assert the rest offset in the mid-settle test. - The skip adds its own
ResizeObserverandMutationObserverper carousel (SnapPaging.ts:510,:517) beside Core's sharedobserveResize, which the pager already uses on this row, andobserveMutations; please subscribe through those, or extend the pager's track observer, as INV16 asks.
[Automated review]
|
/approve-spec e6139a8 |
A row whose end sat 1.37 px past an item's stop had two rests for one page. A flick or a wheel back from the end moved 1.37 px, and a flick onto the last page could rest with the last item cut off. The end's page is the page the end rounds to: a stop within half its step of the end merges into it, and native snap skips that stop's item. So every input rests where the row ends.
There was a problem hiding this comment.
Changes requested: the component:Carousel record changes are approved for this head, so what remains is two fixes in the snap-paging code.
- When an item is added while the row settles, the hand-back scrolls and snaps before the catch-up rewrites the skip (
SnapPaging.ts:497-503), so an item-mode flick from item 4 lands on 514 instead of 411 and skips item 5; please write the due skip inside the hand-back beforescroll-snap-typecomes back, and assert the rest offset in the mid-settle test. - The skip adds its own
ResizeObserverandMutationObserverper carousel (SnapPaging.ts:510,:517) beside Core's sharedobserveResize, which the pager already uses on this row, andobserveMutations; please subscribe through those, or extend the pager's track observer, as INV16 asks.
The end-page rule itself works as described in Chromium: ArrowLeft at the end now moves a whole item, and an item flick reaches the end.
[Automated review]
e6139a8 to
c655d60
Compare
|
/approve-spec c655d60 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet. This pull request is a draft from a fork, so every CI job skipped; once it is marked ready for review, a maintainer adds the ci:run label so CI runs.
The component:Carousel record changes carry an engineering owner's approval for this head, and both earlier requests are addressed: an item added while the row settles now rests on the fifth item, and the skip subscribes through Core's shared resize and mutation observers.
- Non-blocking: every hand-back re-reads the stops, because the takeover's own measure marks the hold due (
SnapPaging.ts:488); please name that reason in the comment aboveresnap.
[Automated review]
| const stops = measured?.stops ?? track.stops(); | ||
| // Native snap follows the new stops. The skip writes in a later | ||
| // frame, so this read stays ahead of any write. | ||
| resnap(); |
There was a problem hiding this comment.
Non-blocking (INV18): this resnap() also runs inside the takeover's own setOptions (line 465), before isMoving is set. Its frame lands in the hold and sets isResnapDue on every gesture, so each hand-back reads the row and every item's rect right after the translates clear: 8 reads per plain flick with no item change. If that re-derivation is meant to catch changes no observer reports (a gap or padding change), please say so in the comment above resnap. It now gives the reason only for a change during a hold. For example: "The takeover's measure also marks the hold due. So every hand-back re-derives the skip, which catches a change that no observer reports."
User impact
With snap paging, a row ending just past an item's stop has two rests for one page. In the partial-last-page story 1 px narrower, a stop sits 1.37 px before the end. A Chromium Shift + wheel back from the end moves 1.37 px. Under
{pages: 'item'}so does a flick back, and a flick onto the last page cuts its last item off by 1.37 px.Problem and solution fit
A stop within half its preceding step of the end now belongs to the end's page, which rests at the end. Native snap skips that stop's item, so wheels, keys and flicks rest on the same pages.
Expected behavior and authority
component:CarouselFR7: "the last page rests where the row ends". Amended here for the spec owners' stamp: FR7's stop sentence adds "except a stop within half its preceding step of the end, which joins the end's page". FR5 points to it, a state and a verification row describe it, andgit diff -wshows only those rows and the separator.Smallest restoration
snapPagesreturns the stops and the items whose stop the end's page takes.scroll-snap-aligntonone, keeping each item's inline value and priority, and restores it once the stop splits from the end or the paging detaches.Evidence
start.Scope
Testing
tsc0; strict ESLint 0 and Prettier clean on the changed files; comment sentence lengths 0 over on the changed lines;check:changesetspasses;check:knowledgereports the records aligned.SnapPaging.test.tsx16 of 16; on main, the 2 new cases fail. Carousel, SnapPaging, hooks and gestures unit suites: 96 files, 1,954 tests pass.Writing rubric results
R1 narration: none; the new state and verification row describe the system in the present tense.
R2 research: none in the record.
R3 evidence: the verification row names the tests and their inputs, not a change.
R4 rejected alternatives: none added.
R5 change references: none.
R6 open questions: none added.