Repository navigation
fix(core): a resize during a pager's settle keeps where it was heading - #10592
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 |
|---|---|---|
| lab/CommentThread | 352.8 kB (+802 B) · 2.4 kB CSS (0) | — |
| lab/Comments | 359.6 kB (+783 B) · 2.5 kB CSS (0) | — |
| Lightbox | 126.7 kB (+679 B) · 10.6 kB CSS (0) | — |
4 more components
| Component | Size | LoC |
|---|---|---|
| DateInput | 192.8 kB (+19 B) · 17.0 kB CSS (0) | — |
| PowerSearch | 299.3 kB (0) · 24.7 kB CSS (0) | — |
| TimeInput | 167.6 kB (−2 B) · 16.0 kB CSS (0) | — |
| DateTimeInput | 215.4 kB (−5 B) · 18.7 kB CSS (0) | — |
Package size: @astryxdesign/core 7.37 MB packed (+4.7 kB); no new dependencies.
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 3d0c0b7 |
There was a problem hiding this comment.
Requesting changes: the resize retarget and the split end behave as described in Chromium, and an engineering owner approved both record changes for this head, but three fixes remain.
- After items are added or removed without the row resizing, the item whose stop the end page took keeps
scroll-snap-align: noneeven once its stop sits more than half a step from the end, so keyboard and wheel scrolling skip a stop that a flick counts as a page (SnapPaging.ts:458-463); re-measure the paging when the row's children change. - The new
spec:AST-094FR6 sentence says a resize "retargets" the settle, butmeasure()ends it at once on the new page (a 218 px jump in Chromium), which FR6's own "A new target MUST keep the current velocity" rules out; reword the sentence to say the settle ends at once, or keep the velocity in code. component:CarouselFR5 ("native snap's per-item stops") and FR7 ("each direct child's start edge") still say every item is a stop, which contradicts the new "Split end" state; amend them to name that exception.
Non-blocking suggestions are inline.
[Automated review]
| // The same page, renumbered: the owner hears it only through a | ||
| // release's report still waiting. | ||
| if (pendingReport == null) { | ||
| report('controlled'); |
There was a problem hiding this comment.
Non-blocking: with a controlled index, this silent sync leaves the owner's index naming another page, and usePager's controlled sync never re-runs because no onIndexChange fires; a later index equal to the new number then moves nothing. No caller passes a controlled index with child pages today, but the module doc's "A controlled index wins" no longer holds here.
There was a problem hiding this comment.
Left as is: no caller passes a controlled index with child pages. A caller that does would need its own sync, in a separate change.
There was a problem hiding this comment.
The pager's module doc names it at bb6aec9. A resize that renumbers the pages keeps the settle's page under its new number, without a report. A controlled index then names the old number. Reporting it is a follow-up row in the description.
3d0c0b7 to
6f396fd
Compare
|
/approve-spec 6f396fd |
There was a problem hiding this comment.
Requesting changes. The Carousel fix works, and an engineering owner approved the spec:AST-094 FR6 change for this head, but one blocking issue remains.
retargetSettle()inusePager.tsrestarts a uniform pager's settle from the old layout's pixel offset, so a Lightbox gallery resized or rotated mid-settle first shows an earlier photo (when the stage widens) or empty space past the last photo (when it narrows near the end) and then slides, where the base shows the target photo at once; keep the shown page fraction for uniform pages by scaling the offset and velocity by the new stride over the old one (or keep the immediate landing there), and add a widen and a narrow uniform-pager test.
Two smaller notes are non-blocking: the comment above the renumbering block restates the branches below it, and the silent renumber leaves a controlled index naming the old number.
[Automated review]
6f396fd to
95aa8c8
Compare
There was a problem hiding this comment.
Requesting changes. Last round's two findings are fixed (uniform pages now keep their fraction of a page through a resize, and a release's report keeps its two-frame wait), and the spec:AST-094 FR6 change carries spec-owner approval at this head, but one blocking issue remains.
- Miss:
measure()remaps a renumbered settle to the page nearest its old pixel offset and replays child pages from the old pixels (usePager.ts:996-1011,:1036-1037), so a Carousel snap-paging row whose items follow the row or viewport width (cqi,vw) rests on the item the person left when it widens mid-swipe, and skips an item when it narrows, where the base rests on the swiped-to item; map the target and the shown position through the item they sit on (for example, keep the index and scale by the page fraction when the page count is unchanged, as the uniform branch does) and add a widen and a narrow case with viewport-relative items.
The silent renumber under a controlled index and the repeated animated-scroll solve stay non-blocking.
[Automated review]
95aa8c8 to
c4319b4
Compare
There was a problem hiding this comment.
Approval waits on an engineering-owner decision on the spec:AST-094 FR6 change, and two fixes are needed either way.
Spec decision: this head adds a new FR6 requirement, "A resize during a settle retargets it. With as many pages as before, the settle keeps its page and its fraction of a page. With another count, a settle toward the last page ends on the last page, and any other on the page nearest its target's offset", with its "FR6 resize" verification row. The earlier /approve-spec comments name earlier heads, and the same-count sentence is new here. An engineering owner records the decision by commenting /approve-spec c4319b445d09484836f1d5f737952e75ef16ff61; the author may do so as an engineering owner.
Blocking:
- In
usePager.ts(lines 1013-1026), a resize that keeps the page count maps the shown position by its page fraction, so a fixed-width view-paging Carousel whose views regroup (the three-per-view story widened from 300 to 400 px) jumps 94 px in one frame mid-settle, which FR6's retarget rule and its "a jump … fails" verification row forbid; decide "same pages" from the items (or from offsets that scaled with the row), keep the pixels otherwise, and add a fixed-width unit case. - The changeset says the row "no longer jumps", but the fixed-width same-count case above still jumps, so fix the jump or narrow the sentence to the cases the tests cover.
The twelve new unit cases and the two new browser cases fail on main and pass on this head in Chromium.
[Automated review]
|
/approve-spec c4319b4 |
There was a problem hiding this comment.
Requesting changes for two fixes. An engineering owner approved the spec:AST-094 FR6 resize change for this head, and in Chromium the pager does what that sentence says; the record change can stay as it is.
Blocking:
- Miss: a still finger that lands on a release's settle no longer stops it when the row resizes inside the 85 ms catch window, because
retargetSettle()inusePager.tscallsstopSettle(), which clears the armed catch, so the settle slides on under the finger against FR6's "A finger MUST be able to catch any animation mid-flight"; keep the pending catch across the retarget and add a unit case for it. - The changeset (
.changeset/pager-resize-settle-retarget.md, line 5) says a resized row "no longer jumps" and plays on "from where it shows", but a fixed-width three-per-view row widened from 300 to 400 px mid-settle keeps its page count and still steps 94 px in one frame, so narrow it, for example to "no longer stops at once or runs back to an earlier page. The settle plays on at its speed, to the last page when it was heading there, and otherwise to the page nearest where it was heading."
The earlier comment on the same-count step in usePager.ts is settled by the approved FR6 sentence. The new unit and browser tests fail on main and pass on this head in Chromium.
[Automated review]
c4319b4 to
c081881
Compare
|
/approve-spec c081881 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet, because the pull request is still a draft; its required checks run once it is marked ready for review.
The resize retarget in the shared pager does what the amended spec:AST-094 FR6 says, and an engineering owner approved that record change for this head. The new unit cases fail on main and pass here, and the new browser cases show the Carousel row ending on its last page instead of running back.
- Non-blocking: a resize that renumbers child pages mid-settle moves the pager's index to the page's new number without
onIndexChange(usePager.ts:1123-1129). No current caller passes a controlledindexwith child pages, and the description already lists it as a follow-up.
|
/approve-spec b01724f |
There was a problem hiding this comment.
Approved pending CI: some required checks are still running on this head, and the WebKit interaction job needs a rerun after it failed one existing SnapPaging case (SnapPaging.interaction.browser.spec.ts:1873) on a touch-pacing fault in its setup swipes, before any resize, a case that passes in Chromium.
The resize retarget in the shared pager does what the amended spec:AST-094 FR6 says, and an engineering owner approved that record change for this head. The new unit and browser cases cover each state of the FR6 resize row and pass in CI on this head, and the key unit cases fail on main, where the track re-places on the old page index's offset.
- Non-blocking: main now gives each document's gesture host its own window clock. For a pager in a same-origin iframe or a Picture-in-Picture window, the retarget's start time (
usePager.ts:1189, clock set at:1602) therefore no longer matches the animator's clock, and taking that time from the animator's clock keeps the replacement settle on its curve there.
Claims and files checked
- Changeset: a row resized mid-settle plays on to the last page or to the page nearest its target, and a resize past the new last page or one that gives the first width still lands at once. Verified:
usePager.ts:1151-1180. - Description: before the change, a resize stops the settle and sets the track on its index's new offset, so a narrowed row runs back. Verified on the base
measure(); the cases atusePager.test.ts:1275and:1343fail there. - Description: pages whose spacings scale keep their page and fraction of a page; others keep the last page or the nearest page by offset, with a tie going the way the settle moves. Verified:
usePager.ts:326-351,:1078-1135,:651-670. - Description: the settle replays from the track's value and velocity, read before measuring, and a direction change, a past-end track or a settle begun with no width re-places at once. Verified:
usePager.ts:1062-1067,:1151-1180. - Description: a renumbered page is not reported, the waiting report and an armed catch carry over, and a finished settle rests on its curve's end. Verified:
usePager.ts:1125-1129,:1216-1228,:1015-1017. - Description: settles with no resize keep main's path. Verified: outside a resize, only the curve-end set at
usePager.ts:1015-1017is new. - Description: the per-case results (row-sized, shared shift, still finger, direction change, measurement, curve end, past end, gapped rotation, regroup, tie, drag, uniform pages, report timing, frame oracle, row-wide widening, past-end landing). Verified: each named case asserts that outcome (
usePager.test.ts:1532-2188;SnapPaging.interaction.browser.spec.ts:417,:864-1442). - Description: the mutation arms. Verified: each removed rule is asserted by the case the arm names.
- Description: this head merges main with no conflict, and main's new record lines sit apart from this change's. Verified: the patch is unchanged, and main's AST-094 lines are a DEC-27 amendment.
.changeset/pager-resize-settle-retarget.md: clear.docs/specs/AST-094-touch-presentations/spec.md: clear (owner-approved for this head).packages/core/src/hooks/usePager.ts: non-blocking notes only.packages/core/src/hooks/usePager.test.ts: clear.packages/core/src/SnapPaging/__tests__/SnapPaging.interaction.browser.spec.ts: clear.
| * starts the retargeted curve, so a stall cannot leave it behind. | ||
| */ | ||
| function readSeed(running: PagerAnimator): Seed { | ||
| const at = clock(); |
There was a problem hiding this comment.
Non-blocking (a regression since main's per-document gesture clock): clock() is the gesture host's arena clock (:1602). For a viewport in a same-origin iframe or a Picture-in-Picture window, that host now reads that window's performance (GestureHost.ts:684-693). The animator from animatorFor(track) still reads the page's motionNow(). So get('x', at) and play({at}) sample and start the replacement settle on another clock, off by the gap between the two windows' time origins. The settle can start part-way through its curve or already finished. Taking at from the animator's own clock keeps the read and the play together, and makes the comment at :611 hold in every document.
| retargetSettle(animator, remap, seed); | ||
| return; | ||
| } | ||
| // A mirrored track has no settle to carry on, so it stops and re-places. |
There was a problem hiding this comment.
Non-blocking (comment): past-end and no-width settles also take this branch, not only a mirrored track. Suggested: "Otherwise the settle stops, and the track re-places on its target."
The widening case flicked the row a page back and widened it two frames into the settle. On a slow frame the row had already crossed where the widened row ends, so the settle rightly played on. A short drag held still now settles the row back onto its last page, away from that end, so the widening always leaves it past the new last page. The case also waits for the page to draw a frame at rest before it reads the frames.
|
/approve-spec b2c11d6 |
There was a problem hiding this comment.
Approved pending CI: the required checks are still running on this head, which left draft after the first CI run skipped it.
The resize retarget in the shared pager does what the amended spec:AST-094 FR6 says, and an engineering owner approved that record change for this head. Since the last review only the browser case for a widening that leaves the row past its new last page changed: it now starts from a held drag back from the end, so it always reaches the branch it tests, which targets the one WebKit failure on the previous head.
- Non-blocking: main gives each document's gesture host its own window clock, so for a pager in a same-origin iframe or a Picture-in-Picture window the retarget's start time (
usePager.ts:1189, clock set at:1602) no longer matches the animator's clock; taking that time from the animator's clock keeps the replacement settle on its curve there.
Claims and files checked
- Changeset: a row resized mid-settle no longer stops at once or runs back; it plays on to the last page or the page nearest its target, ends with no step at the hand-back, and a resize past the new last page or one that gives the first width still lands at once. Verified:
usePager.ts:1017,:1104-1123,:1157-1179,:1203-1256. - Description: before the change, a resize stops the settle and sets the track on its index's new offset, so a narrowed row runs back or a partial last page rests short. Verified on the base
measure(); the cases atusePager.test.ts:1343andSnapPaging.interaction.browser.spec.ts:417encode the fixed outcome. - Description: pages whose spacings scale keep their page and fraction of a page; others keep the last page or the nearest page by offset, a tie going the way the settle moves. Verified:
usePager.ts:326-351,:656-670,:1078-1123. - Description: the settle replays from the track's value and velocity, read before measuring; a direction change, a past-end track or a settle begun with no width re-places at once. Verified:
usePager.ts:1062-1063,:1157-1179. - Description: a renumbered page is not reported, the waiting report and an armed catch carry over, and a finished settle rests on its curve's end. Verified:
usePager.ts:1124-1129,:1219-1228,:1017. - Description: the quoted record text and Carousel's last-page rule. Verified: the current FR6 and Carousel FR7, and the amended FR6 sentence, gap bullet and row in this head's record.
- Description: this head merges main with no conflict onto a commit that changes only the widening case, and main's new record lines sit apart. Verified: the patch differs from the previous head only in that case, and main's record change is a separate decision amendment.
- Description: the widening case failed in WebKit on the previous head, and now settles a held short drag back onto the last page and waits for a frame at rest with no bound changed. Verified: that run's WebKit failure names the case;
SnapPaging.interaction.browser.spec.ts:993-1030, bounds at:1042-1057. - Description: per-case and per-engine run results, the reproduction and mutation arms, and the platform comparison. Stated results: each names a case that asserts that outcome (
usePager.test.ts:1275-2188;SnapPaging.interaction.browser.spec.ts:417,:864,:936,:1060); not rerun on this head. .changeset/pager-resize-settle-retarget.md: clear.docs/specs/AST-094-touch-presentations/spec.md: clear (owner-approved for this head).packages/core/src/hooks/usePager.ts: non-blocking notes only.packages/core/src/hooks/usePager.test.ts: clear.packages/core/src/SnapPaging/__tests__/SnapPaging.interaction.browser.spec.ts: clear.
|
/approve-spec d8497d4 |
There was a problem hiding this comment.
Approved pending CI: the required checks are still running on this head, which left draft after its first CI run skipped every job.
The resize retarget in the shared pager does what the amended spec:AST-094 FR6 says, and an engineering owner approved that record change for this head. Since the last review this head only merges main, which changes no pager code, so the earlier findings stand as they were.
- Non-blocking: for a pager in a same-origin iframe or a Picture-in-Picture window, the retarget's start time comes from that window's gesture clock (
usePager.ts:1189, clock set at:1602) while the animator reads the page's clock; taking that time from the animator's clock keeps the replacement settle on its curve there.
Claims and files checked
- Changeset: a row resized mid-settle no longer stops at once or runs back; it plays on to the last page or the page nearest its target, ends with no step at the hand-back, and a resize past the new last page or one that gives the first width still lands at once. Verified:
usePager.ts:1015-1017,:1104-1123,:1155-1179,:1203-1256. - Description: before the change, a resize stops the settle and sets the track on its index's new offset, so a narrowed row runs back or a partial last page rests short. Verified on the base
measure(); the cases atusePager.test.ts:1343andSnapPaging.interaction.browser.spec.ts:417encode the fixed outcome. - Description: pages whose spacings scale keep their page and fraction of a page; others keep the last page or the nearest page by offset, a tie going the way the settle moves. Verified:
usePager.ts:326-351,:656-670,:1078-1123. - Description: the settle replays from the track's value and velocity, read before measuring; a direction change, a past-end track or a settle begun with no width re-places at once. Verified:
usePager.ts:1062-1063,:1155-1179. - Description: a renumbered page is not reported, the waiting report and an armed catch carry over, and a finished settle rests on its curve's end. Verified:
usePager.ts:1124-1129,:1219-1226,:1015-1017. - Description: the quoted record text and Carousel's last-page rule. Verified: the current FR6 and Carousel FR7, and the amended FR6 sentence, gap bullet and row in this head's record.
- Description: this head merges
mainwith no conflict, and main's new record lines sit apart from this change's, which are as they were. Verified: the merged tree is the clean merge of the two parents; the patch equals the previous head's; main's record change is a BottomSheet sentence under FR36. - Description: per-case and per-engine run results, the reproduction and mutation arms, and the platform comparison. Stated results: each names a case that asserts that outcome (
usePager.test.ts:1275-2188;SnapPaging.interaction.browser.spec.ts:417,:864,:936,:1060); not rerun on this head. .changeset/pager-resize-settle-retarget.md: clear.docs/specs/AST-094-touch-presentations/spec.md: clear (owner-approved for this head).packages/core/src/hooks/usePager.ts: non-blocking notes only.packages/core/src/hooks/usePager.test.ts: clear.packages/core/src/SnapPaging/__tests__/SnapPaging.interaction.browser.spec.ts: clear.
Stack: #10592 → #10927
User impact
A pager resized mid-settle jumps or rests off its page. Narrowed 100 px, a three-per-view Carousel row ran back to the view it left. A partial last page rested 60 px short.
Problem and solution fit
The settle now retargets, keeping its velocity.
Expected behavior and authority
spec:AST-094FR6: "A new target MUST keep the current velocity". Amended here: "A resize during a settle retargets it. When the spacings between pages all scale by one ratio, the settle keeps its page and its fraction of a page. Otherwise a settle toward the last page ends on the last page. Any other ends on the page nearest its target's offset, a tie going the way it moves. A settle that began before the viewport had a width lands on its target at once when the viewport gets one". A resize row and a gap bullet cover the settles that land at once.component:CarouselFR7: "the last page rests where the row ends".UIKit decays toward the old target (iOS 26.2 simulator); FR6 and FR7 require the new pages.
Smallest restoration
measure()maps a settle's target and the page last at rest by offset. The last page stays last; a tie goes the way the settle moves.Evidence
Scope
Testing
spec:AST-094lines sit apart from this change's, which are as they were. On it,LightboxDismiss's reopening case passes 10 of 10 in Chromium, and the widening case 10 of 10 in WebKit through the CI job's container. Every Lightbox, Carousel, SnapPaging, DateInput and TimeInput interaction spec passes in both engines at 1 worker. Chromium passes Lightbox 103, Carousel 8, SnapPaging's set 80 and the wheels 32. WebKit passes 98, 7, 84 and 27. Their units pass, 26 files and 1,122 tests. Coretsc, strict ESLint andcheck:knowledgeare clean.mod, and the pager's new helpers stay above it.index. It changes no code line. On it, usePager's units pass 161 of 161. Coretsc, strict ESLint, Prettier,check:knowledgeandcheck:changesetsare clean.LightboxDismiss's reopening case ran at 1 worker in Chromium, with builds alternating. Main passes 20 of 20, the merge without the fix 12 of 20, and this head 20 of 20. In WebKit main and this head pass 10 of 10.tscreports 0, and the fulluiunit project passes: 975 files, 24,075 tests. At 1 worker, every Lightbox interaction spec passes in both engines, as on main: Chromium 103, WebKit 98. Carousel passes too: Chromium 8, WebKit 7. SnapPaging, its settle and the pager ×3: Chromium 240 passed, WebKit 252. The row-sized case passes 30 of 30 in WebKit. Strict ESLint reports 0.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.usePager.test.tspasses 160 of 160. On main 16 of the 22 new cases fail. The other six guard this change's earlier heads, or keep main's behavior: the two writing-direction cases and the past-end case. The unit suites of Carousel, SnapPaging, Lightbox, hooks, gestures and motion: 138 files, 3,208 tests pass.onSettlefires once.LightboxDismiss's reopening case missed its 5 s close again, a timeout logged for its own fix.Follow-ups
indexwhose page a resize renumbersWriting rubric results
R1 narration: none; the FR6 sentences, its row and its gap bullet state the system in the present tense. The no-width sentence, the row's no-width case and the gap bullet's no-width case are new at this head, for the record owners' approval.
R2 research: none in the record.
R3 evidence: the verification row names the tests and their cases, not a change.
R4 rejected alternatives: none added.
R5 change references: none.
R6 open questions: none added.