Skip to content

fix(NavigationStack): in WebKit a push or pop from rest waits for its frame at rest - #12737

Closed
cixzhang wants to merge 5 commits into
mainfrom
fix/navstack-webkit-first-frame
Closed

cixzhang wants to merge 5 commits into
mainfrom
fix/navstack-webkit-first-frame

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

User impact

On iOS Safari, a NavigationStack push from rest jumped most of the way across in one frame when the new screen's render was heavy (one film showed about 96% of the travel in one frame). After #12010 Chromium starts from the first frame, but iOS Safari still skipped.

Now, in WebKit, a push or pop from rest waits until the frame at rest is on screen and then plays from its start. Chromium and Firefox are unchanged; desktop Safari takes the same WebKit clock.

Problem and solution fit

  1. Why it occurs. WebKit's UI process applies a commit late. A transition from rest that starts at its commit, or at the first frame after an input task (next-frame), is dated before the UI process presents that frame. So after a heavy commit its first presented frame lands near its end.
  2. Fix. In WebKit, NavigationStack's transitionClock asks the Core animator for its existing start: 'presented', which is documented for a UI process that applies commits late. The animations are created two frames later, once the frame at rest has been presented, and start at their commit.
    • A finger's release keeps its release time, as before.
    • Chromium and Firefox keep next-frame (in an input task) or the commit.
    • No Core change.
  3. Engine check. A page can't detect late commit application as a capability, so the check is a narrow engine workaround under spec:AST-013 FR6.
    • It is AppleWebKit without Chrome, the same test Core's CodeBlock uses locally.
    • It is read on the client, at transition time, never during render (FR9).
    • The removal condition sits next to it: remove it when WebKit applies commits on time. Re-check at each Safari major version on iOS.
    • A capability probe in the animator is the longer-term shape, as the Specification session noted.

Expected behavior and authority

  • spec:AST-094 FR45: motion that a tap, a key or the program starts plays its springs from rest. A transition that first presents near its end never played them. FR6's next-frame is the mechanism precedent (react-component-runtime INV13).
  • spec:AST-013 FR6, the engine-workaround clause, with its three conditions:
    • a reproduced defect (the iOS film);
    • a regression fixture (the frame trace below);
    • a removal condition (in the code and in AST-094's FR45 verification row).

Smallest restoration

  • packages/lab/src/NavigationStack/NavigationStack.tsx: appliesCommitsLate(), and a third transitionClock case.
  • NavigationStack.interaction.browser.spec.ts: "a push from rest after a heavy commit starts on the engine's clock".
  • docs/specs/AST-094-touch-presentations/spec.md: one FR45 verification row for the engine line.
  • No changeset: @astryxdesign/lab is private.

Evidence

  • Reproduction: an iOS film of a push after a heavy commit shows about 96% of the travel in one frame. This follows fix(NavigationStack): a push or pop from rest starts when its task ends #12010's fix for Chromium.
  • Regression fixture: a 300 ms block in the push's commit (a row click, an input task in every engine), then the pushed card's offset and frame time in each of the first six frames.
    • Everywhere: the first frame that moves shows no more of the spring than the time since the frame before it (or since the block ended) allows, plus one frame.
    • In WebKit it stays at rest in its first frame.
    • In Chromium and Firefox it moves by the second frame, as before.
  • Fixture results (farm, three runs per engine and build):
    • WebKit 26.5: main moves in its first frame, at 0.49–0.50 of the travel after 57–59 ms. That is within the time-normalized bound, so Linux WebKit shows a late first frame, not the iOS skip. This head holds the first frame at rest, then shows 0.23–0.33 (bounds 0.37–0.46).
    • Chromium 149: unchanged and passing on both builds.
    • Firefox 151 (a farm run with a Firefox project added; the repo's interaction config runs Chromium and WebKit): unchanged and passing on both builds. At e0a81cb the test runs there as written and passes: the first frame moves at 0.16 of the travel, 18.8 ms after the block (bound 0.34).
    • Linux WebKit does not show the UI-process delay. Its trace checks that the first frame stays at rest and that the start fits the time that passed; that WebKit check is removed with the workaround. The reproduction is iOS Safari: the original film, with a main-against-head re-take booked on the iOS Simulator.
  • iOS Safari, real device: Apple iPhone 14, iOS 26.2, Safari 26.2, animation scale 1 (Reduce Motion off), the settings story with a 300 ms block on the pushed screen's mount, finger tap, 3 takes per build.
    • At head f0d911d: two frames at rest, then the first moving frame shows 5.4% / 8.1% / 11.8% of the travel, 13–19 ms after the block.
    • On main (e7bbc5b): one frame at rest, then 5.4% in every take, 7–8 ms after the block.
    • Neither build skips into its curve on this device; both stay within the spring's share for the elapsed time plus one frame. The skip in the original report did not reproduce here, so this run does not show the workaround fixing a defect.
  • Unit tests: the NavigationStack unit suites pass, 41 of 41.

Scope

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Writing rubric results

  • R1 narration: none. The row states the evidence and the failure signal.
  • R2 research: none in the record.
  • R3 evidence: names a test.
  • R4 to R7: none.

Overlap checked: #12010 (the Chromium fix this follows; merged), #12004 (NavigationStack iOS platform back; different hunks, and this lands after it)

… frame at rest

WebKit's UI process applies a commit late, so a from-rest transition that
started at its commit or the next frame skipped into its curve after a
heavy commit on iOS. In WebKit the transition now uses the animator's
start: 'presented'. Chromium and Firefox keep next-frame or the commit.
The engine check is read at transition time, with its removal condition
beside it. A WebKit, Chromium and Firefox frame trace covers it, and
AST-094's FR45 verification gets the engine line.
@vercel

vercel Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 19, 2026 12:27pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟡 Reviewed (for maintainers only) Nov 19, 2026, 12:46 PM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 18, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 18, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 8a2e873

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 18, 2026
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Current run: The current CI run concluded skipped. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

…since the frame before it

A mouse click drives the row in every engine, so Firefox runs too. The
first moving frame may show no more of the spring than the time since the
frame before it (or since the block ended) allows, plus one frame.
…river; state what Linux WebKit guards

Firefox runs the test as written. The engine check and AST-094's FR45 row
say the defect reproduces on iOS Safari and Linux WebKit's trace guards
only a time-correct start; the removal re-check is on iOS.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 19, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec e0a81cb

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 19, 2026

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the new spec row matches the test's click and frame limits and is approved at this head, but the row, the test comment and the description still make claims their evidence does not support, and the iOS result is missing.

  • The new FR45 NavigationStack WebKit row in AST-094 and the test comment say the frame trace runs in Firefox, but the interaction config has only Chromium and WebKit projects, so please drop Firefox there (or add a Firefox project that runs this spec) and approve the new head.
  • The description says Safari and other WebKit browsers, and pops, jumped most of the way in one frame, but the only reproduction is an iOS film of a push and the description's own Linux WebKit result shows no skip, so please narrow it to "On iOS Safari, a NavigationStack push from rest jumped most of the way across in one frame when the new screen's render was heavy."
  • Miss: the description's overlap line says #8200 and #8206 touch NavigationStack's touch path, but both change only DateInput and DateTimeInput files, so please drop them or name the pull requests that do overlap.
  • AST-094 asks for real-device evidence for iOS Safari claims, so please add one line to the description with the device, the iOS Safari version, the head, the animation scale and the first visible frame's share of travel after the change.

Applying the WebKit clock to desktop Safari is covered by the approval at this head together with the stated WebKit mouse results. CI has not run at this head yet.

Claims and files checked

Review mode: same-head; reason: none

  • changed rules (0): none
  • Claim: Safari and other WebKit browsers, push and pop, skipped most of the travel after a heavy render. False as stated: the evidence is an iOS film of a push, and the description's own Linux WebKit result shows no skip.
  • Claim: an iOS film showed about 96% of the travel in one frame. Taken as stated; the device, Safari version, head and animation scale are not given.
  • Claim: Chromium already starts from the first frame since the earlier fix. Verified in history and by the trace, which passes in Chromium on this code.
  • Claim: in WebKit a push or pop from rest now waits for its frame at rest, then plays from its start. Verified in code (NavigationStack.tsx:808-810 with the animator's presented start); not run in WebKit.
  • Claim: Chromium and Firefox are unchanged. Verified in code (NavigationStack.tsx:786, :811); the trace passes in Chromium on both builds.
  • Claim: the cause is WebKit's UI process applying commits late. Consistent with the animator's documentation; not provable here.
  • Claim: the animator's presented start already exists and is documented for late commits. Verified (packages/core/src/motion/animator.ts:75-77, :288-294).
  • Claim: the animations are created two frames later and start at their commit. Verified (animator.ts:288-294).
  • Claim: a finger's release keeps its release time. Verified (NavigationStack.tsx:803-805).
  • Claim: Chromium and Firefox keep next-frame in an input task, or the commit. Verified (NavigationStack.tsx:811).
  • Claim: no Core change. Verified (changed files).
  • Claim: the engine test matches the one CodeBlock uses. Verified (packages/core/src/CodeBlock/CodeBlock.tsx:696-702).
  • Claim: the check is read on the client at transition time, never in render. Verified (NavigationStack.tsx:1202-1207).
  • Claim: the removal condition sits next to the check, re-checked at each Safari major version on iOS. Verified (NavigationStack.tsx:780-781).
  • Claim: a capability probe in the animator is the longer-term shape. Stated as intent in the code comment (NavigationStack.tsx:781-782).
  • Claim: AST-094 FR45 has tap, key and program motion play springs from rest. Verified against the current record's FR45 lines.
  • Claim: the next-frame start is the precedent for a chosen start. Verified (AST-094 FR6 and the runtime record's INV13 name it).
  • Claim: AST-013 FR6's three conditions are met. Verified as stated: the iOS film, the trace, and the removal condition in code and the row.
  • Claim: only three files change, and no changeset is needed because Lab is private. Verified (packages/lab/package.json:4).
  • Claim: the fixture blocks the push's commit for 300 ms after a row click and reads offset and frame time for six frames. Verified (NavigationStack.interaction.browser.spec.ts:1237-1287).
  • Claim: everywhere, the first moving frame shows no more of the spring than the time since the frame before it allows, plus one frame. Verified (:1298-1310).
  • Claim: in WebKit the push stays at rest in its first frame. Asserted (:1291-1293); not run in WebKit.
  • Claim: in Chromium and Firefox it moves by the second frame. Chromium verified (:1294-1296, passes 3 of 3); no configured project runs it in Firefox.
  • Claim: WebKit 26.5 on the base moves in its first frame within the bound, and the head holds it at rest. Not reproduced: WebKit could not run in this review.
  • Claim: Chromium 149 is unchanged and passing on both builds. Verified in Playwright's Chromium on both builds.
  • Claim: Firefox passes through a replica, and with the touch driver dropped Firefox runs the test as written. Not repository coverage: the test no longer needs the touch driver, but the interaction config's projects are Chromium and WebKit only (playwright.interaction.config.ts:85-88).
  • Claim: Linux WebKit's trace guards only a time-correct start. Partly: its WebKit branch also fails a first frame that moves.
  • Claim: the reproduction is iOS Safari, with a simulator re-take booked. No after-result is stated.
  • Claim: the unit suites pass, 41 of 41. Verified: 41 of 41 pass at this head.
  • Claim: no new public API, and no internal context in public text. Verified.
  • Claim: the earlier Chromium fix this follows is merged. Verified: its commit is on the base branch.
  • Claim: two other open pull requests touch NavigationStack's touch path but not its transition clock. False: both change only DateInput and DateTimeInput files and the date picker's motion table, nothing NavigationStack imports.
  • File docs/specs/AST-094-touch-presentations/spec.md: finding (the new row claims a Firefox run); the other 45 rows are only re-padded.
  • File packages/lab/src/NavigationStack/NavigationStack.tsx: clear, apart from a comment accuracy suggestion.
  • File packages/lab/src/NavigationStack/__tests__/NavigationStack.interaction.browser.spec.ts: finding (its comment claims a Firefox run); the trace itself is clear.

Automated review (maintainer link)

…bKit

The interaction config has no Firefox project, so AST-094's FR45 row and
the test comment no longer claim one.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec e3bfff2

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the WebKit clock change and its AST-094 verification row are owner-approved and fit the spec, and the Firefox, scope and overlap points from the last review are fixed, but the iOS Safari result after the change is still missing.

  • AST-094's platform-support rule and DEC-27 need real-device evidence for an iOS Safari claim, so please add one line to the description with the iOS device, iOS Safari version, head, animation scale and the first visible frame's share of travel after the change (no clip needed, and a Simulator take does not cover this claim).

Non-blocking: the row, the code comment at NavigationStack.tsx:778-780 and the description say Linux WebKit's trace guards only a time-correct start, but its WebKit branch also fails a first frame that moves, so removing the workaround later means editing that assertion too.

Claims and files checked

Review mode: full; reason: spec-record

Claims:

  • An iOS Safari push from rest skipped most of its travel after a heavy render: stated reproduction, taken from the description's text.
  • After the earlier next-frame fix, Chromium starts from the first frame: verified (next-frame path at NavigationStack.tsx:811; the earlier Chromium trace in the same spec file).
  • In WebKit a push or pop from rest now waits for its frame at rest: verified in code (NavigationStack.tsx:806-810, reached by push and pop at :1514 and :1540); the iOS outcome is not yet shown.
  • Chromium and Firefox are unchanged and desktop Safari takes the same clock: verified (user-agent check at NavigationStack.tsx:784-787).
  • The animator's existing presented start serves late commits and creates the animations two frames later: verified (animator.ts:75-77, :288-293, unchanged by this pull request).
  • A finger's release keeps its release time: verified (NavigationStack.tsx:803-805).
  • No Core change: verified (three changed files).
  • The check is AppleWebKit without Chrome, as Core's CodeBlock uses locally: verified (CodeBlock.tsx:700-701).
  • The check is read on the client at transition time, never during render: verified (NavigationStack.tsx:1202-1207, inside animateProgress).
  • The removal condition sits beside the check: verified (NavigationStack.tsx:780-781 and the AST-094 row).
  • A capability probe in the animator is the longer-term shape: verified as a code comment (NavigationStack.tsx:781-782).
  • AST-094 FR45 asks for springs from rest and AST-013 FR6 allows a narrow engine workaround with a reproduction, a fixture and a removal condition: verified against both records.
  • One new FR45 verification row, and no changeset because Lab is private: verified (the other table rows are only re-padded; packages/lab/package.json is private).
  • The trace blocks the push's commit for 300 ms, reads six frames, bounds the first moving frame by the elapsed time plus one frame, holds WebKit's first frame at rest and has other engines move by the second frame: verified (NavigationStack.interaction.browser.spec.ts:1221-1311).
  • Chromium is unchanged and the trace passes there on both builds: verified.
  • WebKit 26.5 and Firefox 151 results: stated in the description, not independently checked; Firefox has no project in the repository.
  • Linux WebKit's trace guards only a time-correct start: imprecise, since its WebKit branch also fails a first frame that moves (non-blocking).
  • iOS Safari result after the change: pending, so evidence is missing (blocking).
  • The NavigationStack unit suites pass, 41 of 41: verified.
  • Overlap with the earlier next-frame fix (merged) and the open platform-back pull request (different hunks): verified.
  • No internal context in public text: verified.

Files:

  • docs/specs/AST-094-touch-presentations/spec.md: clear apart from the non-blocking wording note; one owner-approved row, the other rows re-padded.
  • packages/lab/src/NavigationStack/NavigationStack.tsx: clear apart from the same wording note at lines 778-780.
  • packages/lab/src/NavigationStack/__tests__/NavigationStack.interaction.browser.spec.ts: clear; matches the row and the interaction config's Chromium and WebKit projects.

Automated review (maintainer link)

It checks that the first frame stays at rest and that the start fits the
time that passed, so its WebKit check goes with the workaround.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec f0d911d

@github-actions github-actions Bot added needs:spec-owner-review Current knowledge records await owner approval and removed needs:spec-owner-review Current knowledge records await owner approval labels Nov 19, 2026

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the WebKit clock change and its AST-094 verification row are owner-approved and fit the spec, but the iOS Safari result after the change is still missing.

  • AST-094's platform-support rule and DEC-27 need real-device evidence for an iOS Safari claim, so please add one line to the description with the iOS device, iOS Safari version, head, animation scale and the first visible frame's share of travel after the change (no clip needed, and a Simulator take does not cover this claim).

Also, not blocking:

  • Regression: main has since rewritten the DEC-31 row of the same AST-094 verification table and re-padded it, so this branch conflicts there; rebase and add only the new row to main's table, so main's DEC-31 change is kept.
  • A comment-style suggestion for the new removal note in NavigationStack.tsx is inline.
Claims and files checked

Review mode: same-head; reason: none

Claims:

  • An iOS Safari push from rest skipped most of its travel after a heavy render: stated reproduction, taken from the description's text.
  • After the earlier next-frame fix, Chromium starts from the first frame: verified (next-frame path at NavigationStack.tsx:811; the earlier fix is in main's history).
  • In WebKit a push or pop from rest now waits for its frame at rest: verified in code (NavigationStack.tsx:808-810, reached by push and pop at :1514, :1525 and :1540); the iOS outcome is not yet shown.
  • Chromium and Firefox are unchanged and desktop Safari takes the same clock: verified (user-agent check at NavigationStack.tsx:784-787).
  • WebKit applies a commit late, so a start dated at the commit or the next frame lands near its end after a heavy commit: stated cause, consistent with the animator's documentation (animator.ts:75-77), not measured here.
  • The animator's existing presented start creates the animations two frames later and starts them at their commit: verified (animator.ts:288-293, unchanged by this pull request).
  • A finger's release keeps its release time: verified (NavigationStack.tsx:803-805).
  • No Core change: verified (three changed files).
  • A page cannot detect late commits, so the check is a narrow engine workaround under AST-013 FR6: verified against the record's text.
  • The check is AppleWebKit without Chrome, as Core's CodeBlock uses locally: verified (CodeBlock.tsx:701).
  • The check is read on the client at transition time, never during render: verified (NavigationStack.tsx:1202-1207, inside animateProgress).
  • The removal condition sits beside the check, with a re-check at each Safari major version on iOS: verified (NavigationStack.tsx:778-782 and the AST-094 row).
  • A capability probe in the animator is the longer-term shape: verified as a code comment (NavigationStack.tsx:782).
  • AST-094 FR45 asks for springs from rest, with the runtime record's next-frame start as precedent: verified against both records.
  • AST-013 FR6's three conditions are met by the reproduction, the trace and the removal condition in code and in the row: verified.
  • The smallest restoration is the check, one clock case, one trace and one verification row, with no changeset because Lab is private: verified (the other table rows are only re-padded; packages/lab/package.json is private).
  • The trace blocks the push's commit for 300 ms under a row click, reads six frames, bounds the first moving frame by the elapsed time plus one frame, holds WebKit's first frame at rest and has other engines move by the second frame: verified (NavigationStack.interaction.browser.spec.ts:1221-1311).
  • WebKit 26.5 results on main and this head: stated in the description, not independently checked.
  • Chromium is unchanged and the trace passes there on both builds: verified.
  • Firefox 151 results from a separate run, while the repository's interaction config runs Chromium and WebKit: the config part verified (playwright.interaction.config.ts:85-88); the Firefox results stated, not checked.
  • Linux WebKit does not show the delay, and its trace checks that the first frame stays at rest and that the start fits the time that passed, with that check removed with the workaround: verified (NavigationStack.interaction.browser.spec.ts:1291-1293, :1305-1310).
  • iOS Safari result after the change: pending, so evidence is missing (blocking).
  • The NavigationStack unit suites pass, 41 of 41: verified.
  • One defect, no tagalongs, and no hidden public API, default or interaction model: verified (the desktop Safari reach is stated and owner-approved).
  • No internal context in public text: verified.
  • Overlap with the earlier next-frame fix (merged) and the open platform-back pull request (different hunks): verified.

Files:

  • docs/specs/AST-094-touch-presentations/spec.md: one owner-approved row, the other rows re-padded; conflicts with main's newer table (non-blocking).
  • packages/lab/src/NavigationStack/NavigationStack.tsx: clear apart from the comment-style suggestion at lines 780-782.
  • packages/lab/src/NavigationStack/__tests__/NavigationStack.interaction.browser.spec.ts: clear; matches the row and the interaction config's Chromium and WebKit projects.

Automated review (maintainer link)

Comment on lines +780 to +782
* fits the time that passed. Remove it when WebKit applies commits on time:
* re-check at each Safari major version on iOS, and remove the trace's
* WebKit check with it. A capability probe in the animator can replace it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking (comment style): this removal note is one 24-word instruction with three topics, while INV29 asks for at most 20 words in an instruction and one topic per sentence. Suggested:

 * fits the time that passed. Remove it when WebKit applies commits on time.
 * Re-check it at each Safari major version on iOS. Remove the trace's
 * WebKit check with it. A capability probe in the animator can replace it.

@cixzhang

Copy link
Copy Markdown
Contributor Author

(Posted by Cindy's agent.) Closing unmerged. The first-frame skip this change works around did not reproduce on a physical iPhone 14 with iOS 26.2:

  • In a Safari tab, a 300 ms block in the push's commit: main moves 5.4% in its first moving frame (3 of 3 runs).
  • In the Playground route, the same load: main does not skip.
  • In the top-level Settings Heavy Commit story, as a Home Screen app and in a Safari tab: main moves 1.8–6.3% in its first moving frame.

On every run, both builds stay within the spring's share for the elapsed time. An engine-specific workaround needs a reproduced defect, so no WebKit branch ships, and this pull request's NavigationStack record edits close with it. The time-normalized first-frame test lands on its own as a guard, with no engine branch.

@cixzhang cixzhang closed this Nov 19, 2026
@github-actions
github-actions Bot deleted the fix/navstack-webkit-first-frame branch November 20, 2026 06:05

This branch was successfully deployed

1 active deployment
Preview — f0d911d1 Deployed Nov 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant