Repository navigation
fix(motion): a call on a settle tail starts at the browser's commit - #9733
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 |
|---|---|---|
| Slider | 88.9 kB (+76 B) · 9.4 kB CSS (0) | — |
| Switch | 87.1 kB (+69 B) · 10.5 kB CSS (0) | — |
| SegmentedControl | 81.9 kB (+65 B) · 7.8 kB CSS (0) | — |
5 more components
| Component | Size | LoC |
|---|---|---|
| lab/MobilePowerSearch | 214.0 kB (+46 B) · 1.2 kB CSS (0) | — |
| DateTimeInput | 158.8 kB (+5 B) · 17.0 kB CSS (0) | — |
| TimeInput | 90.1 kB (+2 B) · 14.3 kB CSS (0) | — |
| DateInput | 103.3 kB (0) · 15.3 kB CSS (0) | — |
| PowerSearch | 184.5 kB (0) · 20.6 kB CSS (0) | — |
Package size: @astryxdesign/core 6.09 MB packed (+720 B); 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
There was a problem hiding this comment.
Requesting changes for one documentation update; the start-time change itself looks right, and its regression test fails on main and passes here.
- The animator's header (
animator.tsline 67), thestartoption's JSDoc (lines 246–258, including'presented'),beginGroup's JSDoc and comment (lines 2061–2063 and 2098–2101) and the motion README's start bullet still say a retarget always starts at the call, so please state there that a curve whose tail shows as at rest counts as rest and takes the browser's start (and, under'presented', waits its two frames).
Two optional touch-ups: the comment on REST_FRAMES_PER_SECOND could name its subject and say "at most" to match the <= check, and the changeset's "5–10 px" understates the Switch's 22 px return, which skips about 6, 11 and 14 px at 50, 80 and 100 ms late commits.
[Automated review]
| segment.group.resolved || | ||
| shownSince(property, segment) != null) | ||
| shownSince(property, segment) != null) && | ||
| !showsAtRest(property, segment, time) |
There was a problem hiding this comment.
With this clause a retarget on an at-rest tail takes the browser's start, but the file header (line 67), the start option's JSDoc (lines 246–258, including the 'presented' bullet), beginGroup's JSDoc and the comment above this loop (lines 2061–2063, 2098–2101), and the motion README's start bullet still say a retarget always starts at the call. Under start: 'presented' such a call now also waits its two frames. Please update those places to say a curve that shows as at rest counts as rest.
| */ | ||
| const REST_DISTANCE_TOLERANCES = 2; | ||
|
|
||
| /** It must also move less than one sample tolerance a frame at this rate. */ |
There was a problem hiding this comment.
Optional wording: "It" has no referent here, the check below accepts equality (<=), and "sample tolerance" can read as the device-pixel tolerance SAMPLE_TOLERANCE's doc describes. Suggested: /** A curve shows as at rest only while it moves at most one SAMPLE_TOLERANCE (CSS px) a frame at this rate. */
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] Motion: a call made while an animation settles, with the element already still on screen, waits for the browser's first frame as a call from rest does. A busy page no longer skips the start of the new motion, a 5–10 px jump at a Switch's return. |
There was a problem hiding this comment.
Optional: the Switch's 22 px return on its 0.3 s spring skips about 6, 11 and 14 px at 50, 80 and 100 ms late commits, so "a jump of up to about 14 px" fits better than "5–10 px".
0f12f49 to
2dc14bc
Compare
|
Updated in 2dc14bc: the |
There was a problem hiding this comment.
Approval recommended: a retarget on a tail that already shows as at rest now waits for the browser's commit, the new regression tests fail on main and pass here, and a Chromium run of the Switch tap-back with a 100 ms block shows the return no longer skipping into its curve.
Two optional touch-ups:
- The file header of
animator.ts(lines 56–75) still says every retarget keeps a call-time start; thestartoption's sentence "A curve whose tail already shows as at rest counts as rest." would keep it in step. - The changeset's "up to about 14 px" assumes UIKit's 22 px travel; the md Switch travels 16 px, so a 50–100 ms late commit skips about 4–10 px, and "up to about 10 px" fits better than the earlier 14 px suggestion.
[Automated review]
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] Motion: a call made while an animation settles, with the element already still on screen, waits for the browser's first frame as a call from rest does. A busy page no longer skips the start of the new motion, a jump of up to about 14 px at a Switch's return. |
There was a problem hiding this comment.
Optional: "up to about 14 px" assumes UIKit's 22 px travel (63 × 28 track). The md Switch (40 × 24) travels 16 px, so a 50–100 ms late commit skips about 4–10 px (a 100 ms block measured 9.9 px in Chromium); "a jump of up to about 10 px" fits better.
A call that continues motion starts at its own time, from the value and velocity on screen. Under a starved main thread the browser commits it 50-100 ms later and draws the new curve that far into itself, while it drew the old curve until then. For a curve that still moves, that step is the least of the two choices. For one whose tail already shows as at rest, the step is the new curve's first frames, 5-10 px for a Switch's return. A curve within two sample tolerances of its target, moving less than one tolerance a frame at 60 Hz, now shows as at rest, so a call on it starts at the browser's start, as a call from rest does, and its first frame shows its first keyframe. A call while the curve still moves starts at the call, as before. The frame-look case that retargeted inside the old curve's last frame now commits that start first. The start option's docs, the notes on starting from rest and the motion README say so. spec:AST-094 FR6 records the owner's decision for a curve that still moves: on a starved page, a retarget may skip ahead by up to the browser's commit delay. A verification row names the starvation probe.
2dc14bc to
ad5ae03
Compare
|
Updated in ad5ae03: |
|
/approve-spec ad5ae03 |
There was a problem hiding this comment.
Approval recommended: a retarget on a tail that already looks still now waits for the browser's commit, the new regression tests fail on main and pass here, and the spec:AST-094 FR6 amendment has an engineering owner's approval for this head.
Optional touch-ups, left inline: the changeset's "up to about 14 px" fits a commit about 170 ms late (about 10 px matches the 50–100 ms delays the description names), the new FR6 sentence reads as part of the paging paragraph, and the first sentence of the showsAtRest JSDoc restates its name. The animator.ts header (lines 56–57 and 74–75) also still defines rest without the at-rest tail.
[Automated review]
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] Motion: a call made while an animation settles, with the element already still on screen, waits for the browser's first frame as a call from rest does. A busy page no longer skips the start of the new motion, a jump of up to about 14 px at a Switch's return. |
There was a problem hiding this comment.
Optional: the md Switch travels 16 px on its 0.3 s critically damped spring, so a commit 50–100 ms late skips about 4.5–9.9 px; 14 px needs a commit about 170 ms late. "a jump of up to about 10 px" matches the description's 50–100 ms.
| (UIKit zeroes steady releases at 175 and 200 pt/s and keeps 249 pt/s, iOS | ||
| 26.2 simulator, 2026-10-23) until a measurement replaces it (FR2). A page | ||
| change during a drag starts from rest (DEC-25). | ||
| change during a drag starts from rest (DEC-25). On a starved page, a |
There was a problem hiding this comment.
Optional: this sentence follows the DEC-25 pager sentence, and DEC-25 narrows FR6 "for paging only", so it can read as a paging rule. Starting it on its own line, or before the pager text, makes plain that it covers every retarget.
| }; | ||
|
|
||
| /** | ||
| * Whether a curve's tail already shows as at rest at `time`. Under a |
There was a problem hiding this comment.
Optional (comment style): the first sentence restates the name. Keeping only the reason reads: "Under a starved main thread the browser commits a call late. A call that starts at its own time then skips that far into its curve. One that starts at the commit holds an element that hardly moves."
User impact
On a busy page, a Switch tapped back just after its thumb settles jumps up to about 14 px as its return starts. Any motion retargeted as it settles skips its first frames the same way.
Problem and solution fit
Expected behavior and authority
spec:AST-094FR6: a caught animation's "value and its velocity MUST come from the curve". FR6 now also states the owner's decision for curves that still move: "On a starved page, a retarget may skip ahead by up to the browser's commit delay (start-at-call)."Smallest restoration
One condition,
showsAtRest, in the animator's continuing-motion test, with its two constants and the docs that describe the start. A call on a moving curve starts at the call, as before.Evidence
main, a call inside x 0→300's tail starts at the call ("expected 1691 to be null"), so an 80 ms late commit draws the new curve 80 ms in.mainand passes here.Writing rubric results
spec:AST-094, FR6's added sentence and its new verification row:R1 narration: none; both state the system in the present tense.
R2 research: none.
R3 evidence: no cell names a pull request, issue or commit.
R4 rejected alternatives: none added.
R5 change references: none.
R6 open questions: none answered or added.
Scope
Testing
On this head, on
mainaa55b7a:pnpm install --frozen-lockfile, build, type check,test:ui(19,013), the node suites (16,082, with 2 expected failures),check:repo,ASTRYX_STRICT_LINT=1 pnpm lint(0 errors),check:changesets, changeset coverage,check:knowledgeandpnpm review:prepass. On a fresh Storybook build, the Switch accessibility contract passes (12 of 12). The public and internal animators' browser specs, with the Switch and SegmentedControl interaction specs, pass in Chromium pinned to 2 cores at 1 worker (122 of 122) and under the CI WebKit job's command (104 passed; 18 skip by their own engine conditions). At 0f12f49, which has this head's code, the animators' browser specs also passed ×3 in both engines.Switch's frame proofs (P10, P14 and the late first frame) at 4 workers on 2 pinned cores, ×10 per run, four runs per arm in the order A B B A B A A B (A =
mainaa55b7a, B = this change, each arm on its own install and Storybook build): a step out of a thumb held still at its end (38 px for two to four frames, then a 4–11 px jump) shows 8 times onmain(per run 2, 4, 1, 1) and once here (0, 0, 1, 0). Steps in mid-travel, the Known limit, stay within this setup's run-to-run noise (28 onmain, 35 here; per run 3–11 and 6–13), as do P10's compositor reds (75 and 69) and the late first frame (11 and 11), so the total red count does not fall at this load.