Skip to content

fix(NavigationStack): a push or pop from rest starts when its task ends - #12010

Closed
cixzhang wants to merge 9 commits into
mainfrom
fix/navigationstack-from-rest-start
Closed

cixzhang wants to merge 9 commits into
mainfrom
fix/navigationstack-from-rest-start

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

User impact

In an app built on Lab NavigationStack, a push to a heavy screen (one that takes a few hundred milliseconds to mount) skipped its slide: the new screen appeared almost in place in one frame, with about 96 % of the travel gone. A tap on a row felt broken instead of slow. After this change, a push or pop from rest starts when the page is free again and plays its whole motion, so a heavy screen delays the slide but does not skip it in the engines the browser case covers.

Problem and solution fit

  • Why it fails: a push, and a pop started by Back or by code, passed the time of the call (performance.now()) to every animation. When the main thread was held after the call in the same task (the new screen's mount effects, or another listener), the compositor started the animations with that earlier time. So the first frame after the block showed the spring 300 ms in, nearly at rest.
  • The fix: a transition from rest leaves the start to the animator. Its default dates a call from rest by the browser's commit, so a block before the commit delays the motion. In an input event's own task (a tap on a row, a key), the call asks for the animator's internal start: 'next-frame', so the motion starts at the first frame after that task, however long it runs. The stack's own capture handlers for clicks and key presses mark that task, because React may commit the transition in a microtask after the browser has cleared window.event; window.event is only the fallback for a push the app starts outside the stack. A finger's release still passes its release time, so the spring continues from the frame the finger left. The back chevron keeps the screens' clock, as before. Calls in one task share one clock, so the cards, bars and dim stay in step.

Expected behavior and authority

  • spec:AST-094 FR45: motion that a tap, a key or the program starts plays the component's springs from rest. A transition that first shows near its end has not played them.
  • The mechanism follows FR6's swipe-row close, which starts a motion from an input event's own task with the animator's internal start: 'next-frame' (architecture:react-component-runtime INV13), so a later listener's block delays it instead of skipping into it.

The specification owner confirmed this as a records-decided repair with no new API.

Smallest restoration

  • NavigationStack.tsx: transitionClock picks the call options (the release time, start: 'next-frame' in an input task, or the animator's default); animateProgress and the back chevron's fade use them. rememberActivation marks the stack's own input task. A programmatic pop no longer passes a time.
  • One browser test.
  • No public API change. No changeset, because @astryxdesign/lab is private.

Evidence

  • Red first: the first commit adds only the test, a push whose commit blocks the main thread starts from its first frame. A heavy screen holds the main thread for 300 ms in the task that pushes it, and two frames after the block the pushed card must still be more than half its width from rest. With the call's time, a critically damped push is under 1 % from rest after 300 ms; started after the block it is about 70 % from rest after 33 ms. It runs in CI's interaction leg; this machine's sandbox cannot launch Chromium.
  • Unchanged paths: a push keeps advancing every frame while the main thread is blocked and the swipe and release cases are unchanged. The NavigationStack unit suites pass (39 tests in 2 files).
  • Device: the change makes no iOS- or Android-specific claim; the start rule is the same code in every engine, so spec:AST-094 DEC-27's device evidence does not apply. The browser case checks the start against the time since the block, in Chromium and in WebKit (CI's interaction legs). A farm phone take of a push to a heavy screen, before and after, may follow in a comment.

Scope

Components: NavigationStack (lab)

  • 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.

Testing

  • vitest run packages/lab/src/NavigationStack: 39 passed.
  • eslint (strict) on the changed files: no errors.

Overlap checked: #12001, #12009, #12002 (#12001 and #12009 are different NavigationStack defects, the card's stacking and the push's focus, on other lines of the same file; #12002 is a preview of the draft record, not for merge)

Owner and land path

Owner: Cindy's Astryx gaps lane 3 (agent). Land path: Specs stamp as a defect repair, then CodeBunny review on the exact head, then ready, CI, and merge through the drain queue. No release (@astryxdesign/lab is private).

…rts from its first frame

A heavy screen holds the main thread for 300 ms in the task that pushes it. Two frames after the block, the pushed card must still be more than half the width from where it rests. Dated before the block, the push shows almost all of its travel at once.
A push or a programmatic pop passed the time of its call to every animation, so a heavy commit or a later listener that held the main thread after the call made the transition skip ahead into its curve. A transition from rest now leaves the start to the animator: the browser commit dates it, and in an input event's own task it starts at the first frame after that task. A finger's release keeps its release time. The back chevron keeps the screens' clock.
@vercel

vercel Bot commented Nov 16, 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 17, 2026 7:22pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 16, 2026
@astracat-bot

astracat-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 17, 2026, 8:52 PM UTC

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec d9b5c00

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · b78f396

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC
lab/NavigationScreen 85.3 kB (+122 B) · 1.5 kB CSS (0) —
lab/NavigationStack 85.3 kB (+121 B) · 1.5 kB CSS (0) —

Package size: no published package changed; no new dependencies.

Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

…-frame start

The stack's capture handlers for clicks and key presses now mark the task they run in, and the next task clears the mark. A transition that one of them starts uses start: next-frame from that mark, because React may commit it in a microtask, after the browser has cleared window.event. window.event stays as the fallback for a push the app starts outside the stack.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 6875f4a

@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 code fix checks out, but the description misstates two of the records it cites.

  • The description's authority section misstates two records: spec:AST-094 FR6 states its late-commit start only for a retarget's spring and start: 'next-frame' only for a swipe row's close, so cite INV13 and the Lab exemption for this push and pop instead, and DEC-31 only decides when earlier device evidence carries forward, so give DEC-27 as the reason no device take is needed here.

In a Chromium check with the new test's 300 ms blocker, the pushed card still had 99.5 % of its travel ahead about 4 ms after the block on this branch, against 0.8 % on main, and a Back pop behind a later listener now plays from its start too. The inline notes are non-blocking, and CI has not run on this draft yet.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claim: before this change, every push and programmatic-pop animation took the call's time. Verified: the base used startAt ?? performance.now(), and the pop passed it.
  • Claim: a block after the call showed the spring far into its curve (about 96 % of the travel gone). Verified: 99.2 % was gone about 3 ms after a 300 ms block; 96 % fits a block of about 215 ms.
  • Claim: a transition from rest now leaves its start to the animator and asks for start: 'next-frame' in an input task. Verified at NavigationStack.tsx:778-786 and :1160-1164.
  • Claim: the stack's click and key capture handlers mark that task. Verified at :1602-1609 and :1750-1751.
  • Claim: React may commit after the browser has cleared window.event. Not reproduced in Chromium: window.event was still the click in the commit's microtask, for a tap and for Enter.
  • Claim: window.event is the fallback for a push started outside the stack. Verified at :792-798 and :1162-1163.
  • Claim: a finger's release keeps an explicit clock. Verified, and unchanged (:1480, :1681).
  • Claim: the back chevron keeps the screens' clock. Verified at :1183 and :1340.
  • Claim: calls in one task share one start. Verified from the animator's task mark.
  • Claim: a programmatic pop no longer passes a time. Verified at :1487-1495.
  • Claim: the touch-presentations spec's FR6 states this rule. False: FR6 scopes it to a retarget's spring and a swipe row's close.
  • Claim: the component-runtime record's INV13 provides start: 'next-frame' for interaction motion on a busy page. Verified.
  • Claim: the spec owner confirmed this as a records-decided repair. Verified: the author approves both records and posted a spec approval for this head. That approval does not change the wording of the description.
  • Claim: one browser test, no public API change, and no changeset because Lab is private. Verified: the package is private.
  • Claim: red first, with the first commit adding only the test. Verified for the commit. An equivalent probe fails on main and passes on this branch.
  • Claim: the spring numbers (under 1 % from rest after 300 ms; about 70 % after 33 ms). Verified: 0.87 % and 70.2 %, with 69.5 % measured at 36 ms.
  • Claim: the test runs in CI's interaction leg. Not yet verified: CI was skipped on this draft.
  • Claim: the existing busy-thread, swipe and release tests are unchanged. Verified: the diff only adds a test.
  • Claim: the unit suites pass (39 tests in 2 files). Verified.
  • Claim: strict lint is clean on the changed files. Verified.
  • Claim: device evidence follows the carry rule (DEC-31), so no take is needed. Wrong record: DEC-31 only decides carry-over. No take is needed because the PR makes no iOS Safari or Android claim (DEC-27).
  • Claim: the overlapping pull requests change other lines. Verified: one changes the card styles, the other the focus return.
  • File packages/lab/src/NavigationStack/NavigationStack.tsx: non-blocking notes only (the UIEvent check's breadth, the capture mark repeating the fallback in Chromium, one long comment sentence).
  • File packages/lab/src/NavigationStack/__tests__/NavigationStack.interaction.browser.spec.ts: clear. It uses the story's General row and the stack's screen attribute; only the push is pinned, not the pop.

Automated review (maintainer link)

…ents

The window.event fallback took any UIEvent, which includes focus, wheel, input and resize events. It now reads only the pointer, key and touch events a press dispatches, as its comment says. The clock comment is split into short sentences, and the input-task mark notes why it does not rely on window.event.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 4c98b3a

@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 push now plays its whole slide after a main-thread block, but the input-task fallback does not typecheck.

  • Miss: isDispatchingInput (NavigationStack.tsx:809) fails the Lab typecheck with Property 'Event' does not exist on type 'Window' and 'event' is of type 'unknown', so the Lab-only CI typecheck and the required build check will fail; type its parameter as (Window & typeof globalThis) | null | undefined, which ownerDocument.defaultView already is (the previous revision's view.UIEvent failed the same way).

In a Chromium check with the new test's 300 ms blocker, the pushed card still had all of its travel ahead at the first frame after the block, for a tap and for a click() from script, against 0.8 % on main. The unit suites and strict lint pass, the comment wording and the missing pop test are non-blocking notes, and CI has not run on this draft yet.

Claims and files checked

Review mode: same-head; reason: none

  • Rules changed since the last review: changed rules (0).
  • Claim: a push to a heavy screen skipped about 96 % of its travel. Verified in kind at the same base: 99.2 % was gone about 3 ms after a 300 ms block; 96 % fits a shorter block.
  • Claim: a push, and a pop by Back or by code, passed the call's time to every animation. Verified: the base used startAt ?? performance.now(), and the programmatic pop passed it.
  • Claim: a transition from rest now leaves its start to the animator, whose default dates a call from rest by the browser's commit. Verified at NavigationStack.tsx:777-785 and :1172-1176, and in the animator's start option.
  • Claim: in an input event's own task the call asks for start: 'next-frame'. Verified at :784 and :1172-1176.
  • Claim: the stack's click and key capture handlers mark that task. Verified at :1614-1623 and :1764-1765.
  • Claim: React may commit after the browser has cleared window.event. Verified for a click() from page script, where window.event was null in the commit's microtask; for a native tap in Chromium it was still the click.
  • Claim: window.event is only the fallback for a push the app starts outside the stack. Verified at :787-810 and :1174-1175; the fallback fails the typecheck (above).
  • Claim: a finger's release still passes its release time. Verified, unchanged (:1492, :1694).
  • Claim: the back chevron keeps the screens' clock. Verified at :1195 and :1352.
  • Claim: calls in one task share one clock, so cards, bars and dim stay in step. Verified: the animator starts every call from rest in one task at one time.
  • Claim: the touch-presentations spec's FR45 has motion started by a tap, a key or the program play a gesture component's springs from rest. Verified against the record; the sentence that a transition first shown near its end has not played them is the description's reading.
  • Claim: the mechanism follows that spec's swipe-row close (FR6) and the runtime record's start: 'next-frame' rule (INV13). Verified.
  • Claim: the specification owner confirmed a records-decided repair with no new API. Verified: the records' approver posted a spec approval for this revision.
  • Claim: the clock helper, the layer animations, the chevron fade and the activation handler change as listed, and a programmatic pop no longer passes a time. Verified at :767-810, :1172-1298, :1352, :1499-1507 and :1614-1623.
  • Claim: one browser test, no public API change, and no changeset because Lab is private. Verified.
  • Claim: red first, with the first commit adding only the test. Verified for the commit; the same blocked push measured 0.8 % of its travel left on main and all of it on this branch.
  • Claim: the spring numbers (under 1 % from rest after 300 ms; about 70 % after 33 ms). Verified by the spring model (0.87 %, 70.2 %).
  • Claim: the test runs in CI's interaction leg. Verified in the workflow, which runs each interaction spec a Lab-only change edits; CI has not run on this draft.
  • Claim: the existing busy-thread, swipe and release tests are unchanged. Verified: the diff only adds a test.
  • Claim: the unit suites pass (39 tests in 2 files). Verified.
  • Claim: strict lint is clean on the changed files. Verified.
  • Claim: no device take is needed, because the change makes no iOS- or Android-specific claim. Verified against the spec's device-evidence decision, which asks for takes only for such claims.
  • Claim: the overlapping pull requests fix other defects, and the record preview is not for merge. Verified from their titles and files.
  • Claim: no API, visual, default or interaction-model change is hidden, and the text carries no internal context. Verified.
  • File packages/lab/src/NavigationStack/NavigationStack.tsx: blocking typecheck error at :809; non-blocking comment wording at :1617-1618.
  • File packages/lab/src/NavigationStack/__tests__/NavigationStack.interaction.browser.spec.ts: clear; only the push is pinned, not the pop.

Automated review (maintainer link)

…structors

isDispatchingInput reads view.Event, which the Window type does not declare. Its parameter now takes the window with its globals, as ownerDocument.defaultView already is, so the Lab typecheck passes.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 7dbac59

@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.

Approved pending CI: CI has not run on this head yet, because the pull request is a draft; marking it ready for review starts it.

The input-task fallback now typechecks, and with the packages built the Lab and Storybook typecheck passes. In a Chromium check with the new test's 300 ms blocker, the pushed card still had 70.6 % of its travel ahead about 35 ms after the block (0.4 % on main), and a Back tap behind a 300 ms click listener plays its whole slide too. Two non-blocking notes remain: the comment in rememberActivation could name the scripted click() case it serves, and a pop case beside the push test would pin the other half of the title.

Claims and files checked

Review mode: incremental; reason: none

  • Rules changed since the last review: changed rules (0).
  • Claim: a push to a heavy screen skipped about 96 % of its travel. Verified in kind on main: 99.6 % was gone about 36 ms after a 300 ms block; a shorter block leaves a little more.
  • Claim: a push, and a pop by Back or by code, passed the call's time to every animation. Verified: the base used startAt ?? performance.now(), and the programmatic pop passed it.
  • Claim: a transition from rest now leaves its start to the animator, whose default dates a call from rest by the browser's commit. Verified at NavigationStack.tsx:777-785 and :1174-1178, and in the animator's start option.
  • Claim: in an input event's own task the call asks for the next-frame start. Verified at :784 and :1174-1178.
  • Claim: the stack's click and key capture handlers mark that task, because React may commit after window.event is cleared. Verified at :1616-1625 and :1766-1767; for a click() from page script, window.event was undefined when the pushed screen mounted, and the push still played.
  • Claim: window.event is only the fallback for a push the app starts outside the stack. Verified at :788-812 and :1176-1177; it now typechecks.
  • Claim: a finger's release still passes its release time. Verified, unchanged (:1486-1495, :1686-1697).
  • Claim: the back chevron keeps the screens' clock. Verified at :1197 and :1354.
  • Claim: calls in one task share one clock, so cards, bars and dim stay in step. Verified: the animator starts every call from rest in one task at one time.
  • Claim: the touch-presentations spec has motion that a tap, a key or the program starts play a gesture component's springs from rest. Verified against the record, which says a tap carries no velocity; the sentence that a transition first shown near its end has not played them is the description's reading.
  • Claim: the mechanism follows that spec's swipe-row close and the runtime record's next-frame start. Verified against both records.
  • Claim: the specification owner confirmed a records-decided repair with no new API. Verified: the records' approver posted a spec approval for this revision.
  • Claim: the clock helper, the layer animations, the chevron fade and the activation handler change as listed, and a programmatic pop no longer passes a time. Verified at :767-812, :1174-1300, :1354, :1501-1509 and :1616-1625.
  • Claim: one browser test, no public API change, and no changeset because Lab is private. Verified.
  • Claim: red first, with the first commit adding only the test. Verified for the commit; with the test's blocker on the same story, the pushed card had 0.4 % of its travel left on main and 70.6 % on this branch, against the test's 50 % floor.
  • Claim: the spring numbers (under 1 % from rest after 300 ms; about 70 % after 33 ms). Verified by the spring model (0.87 %, 70.2 %).
  • Claim: the test runs in CI's interaction leg. Verified in the workflow, which runs each interaction spec a Lab-only change edits; CI has not run on this draft.
  • Claim: the existing busy-thread, swipe and release tests are unchanged. Verified: the diff only adds a test.
  • Claim: the unit suites pass (39 tests in 2 files). Verified.
  • Claim: strict lint is clean on the changed files. Verified.
  • Claim: no device take is needed, because the change makes no iOS- or Android-specific claim. Verified against the spec's device-evidence decision.
  • Claim: the overlapping pull requests fix other defects on other lines, and the record preview is not for merge. Verified from their titles and changed hunks.
  • Claim: no API, visual, default or interaction-model change is hidden, and the text carries no internal context. Verified.
  • File packages/lab/src/NavigationStack/NavigationStack.tsx: the typecheck finding is fixed; non-blocking comment wording at :1617-1620.
  • File packages/lab/src/NavigationStack/__tests__/NavigationStack.interaction.browser.spec.ts: clear; only the push is pinned, not the pop.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 17, 2026 16:17
@cixzhang cixzhang added the release-critical Admitted to CI at once (AST-030 DEC-30). Counts only when a writer applies it. label Nov 17, 2026
Main moved past #12297 (CI planner budget); a clean merge, no conflicts.
@cixzhang
cixzhang marked this pull request as draft November 17, 2026 16:37

@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: in Chromium the push and the Back pop now play their slide after a main-thread block, but CI's WebKit leg fails the new push test at this revision.

  • Found by CI: a push whose commit blocks the main thread starts from its first frame fails in WebKit (NavigationStack.interaction.browser.spec.ts:1196, received 0.167 against the 0.5 floor, about 130 ms into the push spring), which fails the required test check, so either make the push's start hold in WebKit or, if only that leg's frames are slow, assert on the time since the block instead of on two frames.
  • Found by CI: the description's "the start rule is the same in every browser … and the browser case proves it" and "never skips it" are not shown for WebKit, so make the WebKit case pass or limit that wording to Chromium.

The eight test-node legs also fail with "Node legs over budget" before any test runs; that comes from the repository's Node leg plan, not from this change. The two earlier non-blocking notes still stand: the comment in rememberActivation could name the scripted click() case it serves, and a pop case beside the push test would pin the other half of the title.

Claims and files checked

Review mode: same-head; reason: none

  • Rules changed since the last review: changed rules (0).
  • Claim: a push to a heavy screen skipped most of its travel (about 96 %). Verified in kind on main: 99.6 % was gone 34 ms after a 300 ms block; a shorter block leaves a little more.
  • Claim: a push, and a pop by Back or by code, passed the call's time to every animation. Verified: the base used startAt ?? performance.now(), and the programmatic pop passed it.
  • Claim: a transition from rest now leaves its start to the animator, whose default dates a call from rest by the browser's commit. Verified at NavigationStack.tsx:777-785 and :1174-1178, and in the animator's start option.
  • Claim: in an input event's own task the call asks for the next-frame start, so the motion starts at the first frame after that task. Verified in Chromium (71.4 % of the push left 34 ms after a 300 ms block); not shown in WebKit, where CI fails the new test.
  • Claim: the stack's click and key capture handlers mark that task, because React may commit after window.event is cleared. Verified at :1616-1625 and :1766-1767; for a click() from page script window.event was undefined when the pushed screen mounted, and the push still played.
  • Claim: window.event is only the fallback for a push the app starts outside the stack. Verified at :787-812 and :1176-1177.
  • Claim: a finger's release still passes its release time. Verified, unchanged (:1486-1495, :1686-1697).
  • Claim: the back chevron keeps the screens' clock. Verified at :1197 and :1354.
  • Claim: calls in one task share one clock, so cards, bars and dim stay in step. Verified: the animator starts every call from rest in one task at one time.
  • Claim: the touch-presentations spec has motion that a tap, a key or the program starts play the component's springs. Verified for a gesture component's tap-started moves; the sentence that a transition first shown near its end has not played them is the description's reading.
  • Claim: the mechanism follows that spec's swipe-row close and the runtime record's next-frame start. Verified against both records.
  • Claim: the specification owner confirmed a records-decided repair with no new API. Verified: the records' approver posted a spec approval for this revision.
  • Claim: the clock helper, the layer animations, the chevron fade and the activation handler change as listed, and a programmatic pop no longer passes a time. Verified at :766-812, :1174-1300, :1354, :1501-1509 and :1616-1625.
  • Claim: one browser test, no public API change, and no changeset because Lab is private. Verified.
  • Claim: red first, with the first commit adding only the test. Verified for the commit; with the test's blocker the pushed card had 0.4 % of its travel left on main.
  • Claim: the spring numbers (under 1 % from rest after 300 ms; about 70 % after 33 ms). Verified by the spring model (0.87 %, 70.2 %).
  • Claim: the test runs in CI's interaction leg. Verified: it ran in both legs; it passes in Chromium and fails in WebKit.
  • Claim: the existing busy-thread, swipe and release tests are unchanged. Verified: the diff only adds a test.
  • Claim: the unit suites pass (39 tests in 2 files). Verified.
  • Claim: strict lint is clean on the changed files. Verified.
  • Claim: no device take is needed, and the start rule is the same in every browser, which the browser case proves. The device part is verified; the every-browser part is false at this revision, since the browser case fails in WebKit.
  • Claim: the overlapping pull requests fix other defects on other lines, and the record preview is not for merge. Verified from their titles and changed hunks.
  • Claim: no API, visual, default or interaction-model change is hidden, and the text carries no internal context. Verified.
  • File packages/lab/src/NavigationStack/NavigationStack.tsx: clear apart from non-blocking comment wording at :1617-1620.
  • File packages/lab/src/NavigationStack/__tests__/NavigationStack.interaction.browser.spec.ts: blocking, fails in WebKit at :1196; only the push is pinned, not the pop.

Automated review (maintainer link)

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 21e1fc5

@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 pull request's own push test fails in CI's WebKit interaction leg on the changes this revision carries, so it still needs a fix before it can merge.

  • Found by CI: a push whose commit blocks the main thread starts from its first frame fails in WebKit (NavigationStack.interaction.browser.spec.ts:1196, received 0.167 against the 0.5 floor, about 130 ms into the push spring), which fails the required test check, so either make the push's start hold in WebKit or, if only that leg's frames are slow, assert on the time since the block instead of on two frames.
  • Found by CI: the description's "the start rule is the same in every browser … and the browser case proves it" and "never skips it" are not shown for WebKit, so make the WebKit case pass or limit that wording to Chromium.

CI has not run on this revision because the pull request is a draft; the WebKit result above comes from the same changes before main was merged in. Two non-blocking notes still stand: the comment in rememberActivation could name the scripted click() case it serves, and a pop case beside the push test would pin the other half of the title.

Claims and files checked

Review mode: same-head; reason: none

  • Claim: a push to a heavy screen skipped most of its travel (about 96 %). Verified in kind on the base: 99.6 % was gone 34 ms after a 300 ms block; a shorter block leaves a little more.
  • Claim: a push, and a pop by Back or by code, passed the call's time to every animation. Verified: the base used startAt ?? performance.now(), and the programmatic pop passed it.
  • Claim: a transition from rest now leaves its start to the animator, whose default dates a call from rest by the browser's commit. Verified at NavigationStack.tsx:777-785 and :1174-1178, and in the animator's start option.
  • Claim: in an input event's own task the call asks for the next-frame start, so the motion starts at the first frame after that task. Verified in Chromium (71.4 % of the push left 34 ms after a 300 ms block); not shown in WebKit, where CI fails the new test.
  • Claim: the stack's click and key capture handlers mark that task, because React may commit after window.event is cleared. Verified at :1616-1625 and :1766-1767; for a click() from page script window.event was undefined when the pushed screen mounted, and the push still played.
  • Claim: window.event is only the fallback for a push the app starts outside the stack. Verified at :787-812 and :1176-1177.
  • Claim: a finger's release still passes its release time. Verified, unchanged (:1486-1495, :1686-1697).
  • Claim: the back chevron keeps the screens' clock. Verified at :1197 and :1354.
  • Claim: calls in one task share one clock, so cards, bars and dim stay in step. Verified: the animator starts every call from rest in one task at one time.
  • Claim: the touch-presentations spec has motion that a tap, a key or the program starts play the component's springs. Verified for a gesture component's tap-started moves; the sentence that a transition first shown near its end has not played them is the description's reading.
  • Claim: the mechanism follows that spec's swipe-row close and the runtime record's next-frame start. Verified against both records.
  • Claim: the specification owner confirmed a records-decided repair with no new API. Verified: the records' approver posted a spec approval for this revision.
  • Claim: the clock helper, the layer animations, the chevron fade and the activation handler change as listed, and a programmatic pop no longer passes a time. Verified at :766-812, :1174-1300, :1354, :1501-1509 and :1616-1625.
  • Claim: one browser test, no public API change, and no changeset because Lab is private. Verified.
  • Claim: red first, with the first commit adding only the test. Verified for the commit; with the test's blocker the pushed card had 0.4 % of its travel left on the base.
  • Claim: the spring numbers (under 1 % from rest after 300 ms; about 70 % after 33 ms). Verified by the spring model (0.87 %, 70.2 %).
  • Claim: the test runs in CI's interaction leg. Verified on the same changes before the merge: it ran in both legs, passing in Chromium and failing in WebKit; CI has not run on this revision.
  • Claim: the existing busy-thread, swipe and release tests are unchanged. Verified: the diff only adds a test.
  • Claim: the unit suites pass (39 tests in 2 files). Verified on the same changes before the merge.
  • Claim: strict lint is clean on the changed files. Verified on the same changes before the merge.
  • Claim: no device take is needed, and the start rule is the same in every browser, which the browser case proves. The device part is verified; the every-browser part is false, since the browser case fails in WebKit.
  • Claim: the overlapping pull requests fix other defects on other lines, and the record preview is not for merge. Verified from their titles and changed hunks.
  • Claim: no API, visual, default or interaction-model change is hidden, and the text carries no internal context. Verified.
  • File packages/lab/src/NavigationStack/NavigationStack.tsx: clear apart from non-blocking comment wording at :1617-1620.
  • File packages/lab/src/NavigationStack/__tests__/NavigationStack.interaction.browser.spec.ts: blocking, fails in WebKit at :1196; only the push is pinned, not the pop.
  • The merge of main changes neither file.

Automated review (maintainer link)

… block

WebKit's first frames after a long task can take far longer than 16 ms, so two frames were not a fixed time into the push. The case now reads performance.now() with the position and checks that at least half of what the spring leaves at that time is still to travel, which a push dated before the block cannot meet. The activation-mark comment names the scripted click it serves.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 73c1c5e

Main brought in #12009, which touches NavigationStack.tsx and its test on other lines; a clean merge.

@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 push fix holds up in Chromium, but the rewritten blocked-push test compares the card with a spring that is not the push's, so its WebKit leg checks much less than it says.

  • The floor at NavigationStack.interaction.browser.spec.ts:1204 (leftAt) is a 0.19 s critically damped spring from rest, not the file's push spring (OMEGA, starting at PUSH_VELOCITY), so 130 ms after the block it asks for 3.5 % of the width where half of the push's share is 8.5 %, and a push started up to 93 ms inside the block still passes; build leftAt from OMEGA and PUSH_VELOCITY as the inline comment shows.

CI has not run on this revision because the pull request is a draft, so the WebKit result is still open. In Chromium the head passes the test and the base fails it, also when one frame after the block takes 100 ms. A test of the pop half of the title would still help.

Claims and files checked

Review mode: incremental; reason: none

  • Claim: a push to a heavy screen skipped most of its slide. Verified in kind on the base: 99.7 % of the travel was gone 45 ms after a 300 ms hold.
  • Claim: after the change a push or pop from rest plays its whole motion and is delayed, not skipped, in the engines the browser case covers. Verified in Chromium (66.7 % of the slide left 40 ms after the hold); not shown in WebKit, where CI has not run and the test's floor is looser than stated (blocking finding).
  • Claim: a push, and a pop by Back or by code, passed the call's time to every animation. Verified on the base (startAt ?? performance.now(), and the programmatic pop passed it).
  • Claim: a transition from rest now leaves its start to the animator, which dates it by the browser's commit. Verified at NavigationStack.tsx:777-785 and in the animator's start option.
  • Claim: in an input event's own task the call asks for the next-frame start. Verified at :1174-1178.
  • Claim: the stack's click and key capture handlers mark that task, and window.event is only the fallback. Verified at :1616-1625, :1766-1767 and :804-812.
  • Claim: a finger's release keeps its release time. Verified, unchanged.
  • Claim: the back chevron keeps the screens' clock. Verified at :1197 and :1354.
  • Claim: calls in one task share one clock. Verified in the animator.
  • Claim: the touch-presentations spec has motion a tap, a key or the program starts play the component's springs. Verified for a gesture component's tap-started moves; that a transition first shown near its end has not played them is the description's reading.
  • Claim: the mechanism follows the swipe row's next-frame close. Verified: Core's swipe row passes the same start from its own listener.
  • Claim: the specification owner confirmed a repair with no new API. Verified: the owner's spec approval for this revision is posted.
  • Claim: the clock helper, layer animations, chevron fade and activation mark change as listed, and a programmatic pop passes no time. Verified at :766-812, :1174-1300, :1354, :1501-1509 and :1616-1625.
  • Claim: one browser test, no public API change, no changeset because Lab is private. Verified.
  • Claim: red first, the first commit adding only the test with a half-width floor. Verified for that commit; the test at this revision checks a time-based floor instead.
  • Claim: the spring numbers (under 1 % after 300 ms, about 70 % after 33 ms). Verified (0.87 %, 70.2 %).
  • Claim: the test runs in CI's interaction legs. Not yet at this revision: the pull request is a draft.
  • Claim: the existing busy-thread, swipe and release cases are unchanged. Verified.
  • Claim: the unit suites pass (39 tests in 2 files) and strict lint is clean. Verified.
  • Claim: no device take is needed because the start rule is the same code in every engine. Verified.
  • Claim: the browser case checks the start against the time since the block in Chromium and WebKit. It reads the time since the block, but its curve is not the push spring (blocking finding).
  • Claim: the overlapping pull requests fix other defects and the record preview is not for merge. Verified from their titles and files.
  • Claim: no hidden API, visual, default or interaction-model change, and no internal context. Verified.
  • File packages/lab/src/NavigationStack/NavigationStack.tsx: clear.
  • File packages/lab/src/NavigationStack/__tests__/NavigationStack.interaction.browser.spec.ts: blocking at :1204; only the push is pinned, not the pop (non-blocking).

Automated review (maintainer link)

leftAt was a 0.19 s critically damped spring from rest, so at WebKit's slower frames the floor asked for less than half of what the push leaves. It is now the file's push spring (OMEGA, starting at PUSH_VELOCITY), so a push dated inside the block fails at any frame delay.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec b78f396

@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.

Approved: CI now passes at this revision, including the WebKit interaction leg that had timed out before, and the new blocked-push test passes in both the Chromium and the WebKit legs.

The blocked-push test fails on the base and passes on this head in Chromium, and a Back pop behind a 300 ms hold also keeps its slide here.

Non-blocking:

  • Miss: when the observer never sees the General screen, blockEnd falls back to 0 and the floor drops to about 10⁻¹⁷, so the test passes without its block; fail when blockEnd is missing (NavigationStack.interaction.browser.spec.ts:1192-1193).
  • A test of the pop half of the title would still help, and the description's "Red first" floor and "39 passed" count predate this head.
Claims and files checked

Review mode: same-head; reason: none

  • Claim: a push to a heavy screen skipped most of its slide. Verified in kind on the base: 99.7 % of the travel was gone 45 ms after a 300 ms hold.
  • Claim: after the change a push or pop from rest starts when the page is free and plays its whole motion in the engines the browser case covers. Verified: in Chromium for the push (63.8 % of the slide left 43 ms after the hold) and the Back pop (69.5 % at 36 ms); in WebKit, CI's interaction leg passes the push test.
  • Claim: a push, and a pop by Back or by code, passed the call's time to every animation. Verified on the base (startAt ?? performance.now(), and the programmatic pop passed the effect's time).
  • Claim: a transition from rest now leaves its start to the animator, which dates it by the browser's commit. Verified at NavigationStack.tsx:777-785 and in the animator's start option.
  • Claim: in an input event's own task the call asks for the next-frame start. Verified at :1175-1179.
  • Claim: the stack's click and key capture handlers mark that task, and window.event is only the fallback. Verified at :1627-1636, :1777-1778 and :804-812.
  • Claim: a finger's release keeps its own time. Verified, unchanged (:1496-1506).
  • Claim: the back chevron keeps the screens' clock. Verified at :1198 and :1355.
  • Claim: calls in one task share one clock, so cards, bars and dim stay in step. Verified in the animator's start rule.
  • Claim: the touch-presentations record has motion a tap, a key or the program starts play the component's springs. Verified for a gesture component's tap-started moves; that a transition first shown near its end has not played them is the description's reading.
  • Claim: the mechanism follows the swipe row's next-frame close. Verified: the touch-presentations record states that close with the same internal start.
  • Claim: the specification owner confirmed a repair with no new API. Verified: the owner's spec approval for this revision is posted.
  • Claim: the clock helper, layer animations, chevron fade and activation mark change as listed, and a programmatic pop passes no time. Verified at :766-812, :1175-1300, :1355, :1512-1520 and :1627-1636.
  • Claim: one browser test, no public API change, and no changeset because Lab is private. Verified.
  • Claim: red first, the first commit adding only the test. Verified for that commit, whose floor was half the width; the head's floor is half the push spring's share at the measured time (non-blocking wording note).
  • Claim: a push dated at the call is under 1 % from rest after 300 ms, and one started after the block about 70 % from rest after 33 ms. Verified (0.87 %, 70.2 %).
  • Claim: the test runs in CI's interaction leg. Verified: CI's Chromium and WebKit interaction legs ran it at this revision and it passed in both.
  • Claim: the busy-thread, swipe and release cases are unchanged. Verified; CI's Chromium leg passed all 55 tests of the changed spec, and its WebKit leg passed 49 with 6 Chromium-only cases skipped.
  • Claim: the unit suites pass (39 tests in 2 files). Verified in substance: 40 tests in 2 files pass, the 40th arriving with the merge of the base branch.
  • Claim: strict lint on the changed files is clean. Verified; CI's lint job passed too.
  • Claim: no device take is needed because the start rule is the same code in every engine. Verified.
  • Claim: the browser case checks the start against the time since the block, in Chromium and WebKit. Verified in the code, with the push spring as the floor, and in both of CI's interaction legs.
  • Claim: the overlapping pull requests fix other defects and the record preview is not for merge. Verified from their titles; the focus fix has merged.
  • Claim: no hidden API, visual, default or interaction-model change, and no internal context. Verified.
  • File packages/lab/src/NavigationStack/NavigationStack.tsx: clear.
  • File packages/lab/src/NavigationStack/__tests__/NavigationStack.interaction.browser.spec.ts: clear for the floor; non-blocking: it passes without its block (:1192-1193), and only the push is pinned, not the pop.

Automated review (maintainer link)

Comment on lines +1192 to +1193
const blockEnd =
(window as Window & {blockEnd?: number}).blockEnd ?? 0;

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 (Miss): if the MutationObserver never sees screen-General (a renamed screen key, say), blockEnd falls back to 0. sinceBlock is then the page's whole age, and 0.5 * leftAt(sinceBlock) is about 10⁻¹⁷, so any card not exactly at rest passes and the test no longer checks a start after a block. Return the raw value and fail when the block did not run:

const blockEnd = (window as Window & {blockEnd?: number}).blockEnd;
resolve({x, blockEnd, sinceBlock: performance.now() - (blockEnd ?? 0)});
// after page.evaluate:
expect(blockEnd).toBeDefined();

@cixzhang
cixzhang marked this pull request as ready for review November 17, 2026 19:31
@cixzhang cixzhang removed the release-critical Admitted to CI at once (AST-030 DEC-30). Counts only when a writer applies it. label Nov 17, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

(Posted by Cindy's agent.) Landed on main as 96687ea (squash of head b78f396, merged through merge-guard at 21:01Z). GitHub didn't record this PR as merged, so I'm closing it by hand; the change is in main.

@cixzhang cixzhang closed this Nov 17, 2026
nbozidarevic pushed a commit to nbozidarevic/astryx that referenced this pull request Nov 17, 2026
…ds (meta#12010)

* test(NavigationStack): a push whose commit blocks the main thread starts from its first frame

A heavy screen holds the main thread for 300 ms in the task that pushes it. Two frames after the block, the pushed card must still be more than half the width from where it rests. Dated before the block, the push shows almost all of its travel at once.

* fix(NavigationStack): a push or pop from rest starts when its task ends

A push or a programmatic pop passed the time of its call to every animation, so a heavy commit or a later listener that held the main thread after the call made the transition skip ahead into its curve. A transition from rest now leaves the start to the animator: the browser commit dates it, and in an input event's own task it starts at the first frame after that task. A finger's release keeps its release time. The back chevron keeps the screens' clock.

* fix(NavigationStack): the stack marks its own input task for the next-frame start

The stack's capture handlers for clicks and key presses now mark the task they run in, and the next task clears the mark. A transition that one of them starts uses start: next-frame from that mark, because React may commit it in a microtask, after the browser has cleared window.event. window.event stays as the fallback for a push the app starts outside the stack.

* fix(NavigationStack): the input-task fallback reads only a press's events

The window.event fallback took any UIEvent, which includes focus, wheel, input and resize events. It now reads only the pointer, key and touch events a press dispatches, as its comment says. The clock comment is split into short sentences, and the input-task mark notes why it does not rely on window.event.

* fix(NavigationStack): type the input-task fallback for the window constructors

isDispatchingInput reads view.Event, which the Window type does not declare. Its parameter now takes the window with its globals, as ownerDocument.defaultView already is, so the Lab typecheck passes.

* Merge main into PR meta#12010's branch

Main moved past meta#12297 (CI planner budget); a clean merge, no conflicts.

* test(NavigationStack): the blocked-push case reads the time since the block

WebKit's first frames after a long task can take far longer than 16 ms, so two frames were not a fixed time into the push. The case now reads performance.now() with the position and checks that at least half of what the spring leaves at that time is still to travel, which a push dated before the block cannot meet. The activation-mark comment names the scripted click it serves.

* Merge main into PR meta#12010's branch

Main brought in meta#12009, which touches NavigationStack.tsx and its test on other lines; a clean merge.

* test(NavigationStack): the blocked-push floor is the push's own spring

leftAt was a 0.19 s critically damped spring from rest, so at WebKit's slower frames the floor asked for less than half of what the push leaves. It is now the file's push spring (OMEGA, starting at PUSH_VELOCITY), so a push dated inside the block fails at any frame delay.
cixzhang added a commit that referenced this pull request Nov 18, 2026
Main brought in the merged NavigationStack fixes (#12009, #12010, #12001) on other lines of NavigationStack.tsx and its test; a clean merge.
@github-actions
github-actions Bot deleted the fix/navigationstack-from-rest-start branch November 18, 2026 06:04
cixzhang added a commit that referenced this pull request Nov 21, 2026
…ys no second animation (#12004)

* test(sandbox): a raw page that logs whether the platform animated a history back

On a real phone, the page pushes two history entries and logs each popstate and Navigation API navigate event with its hasUAVisualTransition, and the display mode it runs in. It is the evidence page for NavigationStack skipping its own pop or push animation after a platform-animated traversal.

* fix(NavigationStack): a platform-animated history back or forward plays no second animation

When the platform has just animated a history traversal (Safari's edge swipe back or forward, an iOS Home Screen app's back gesture), the browser sets hasUAVisualTransition on the Navigation API navigate event and on popstate. The stack marks it for two frames, and the path change that traversal causes is applied at once: a pop drops the leaving screen with no slide, a push puts the new screen on top with no slide. Focus moves as after any settled push or pop. A traversal the platform did not animate still slides.

* fix(NavigationStack): the traversal listeners attach with the container

The popstate and navigate listeners now attach in the container ref callback on the element window, beside the modality tracker, and detach with it, so a stack moved to another document listens to its new window. The probe page keys screens by position and name, sets the path when the stack pops before it moves the history, and leaves its own two entries out of the stack path.

* test(sandbox): the probe stack follows a back to the page's first entry

The router marks the first history entry, so its state is neither null nor a stack path. The probe now skips only its own two step entries and treats any other entry without a path as the root. The component JSDoc names the exception to its animation.

* Merge main into PR #12004's branch

Main moved past #12297 (CI planner budget); a clean merge, no conflicts.

* Merge main into PR #12004's branch

Main brought in the merged NavigationStack fixes (#12009, #12010, #12001) on other lines of NavigationStack.tsx and its test; a clean merge.

* Merge main into fix/navigationstack-ios-platform-back

* chore(sandbox): drop the history-back probe page from this change

The probe page served only the device takes. Without it this pull request
changes the Lab NavigationStack and its test alone.

* test(NavigationStack): a traversal that hides the stack before the mark clears leaves no mark

* fix(NavigationStack): detaching the traversal listener clears the platform mark

A container that detached within two frames of a browser-marked traversal
kept the mark, so the next tap push or Back pop played no slide.

* Merge main into fix/navigationstack-ios-platform-back

This branch was successfully deployed

1 active deployment
Preview — b78f3963 Deployed Nov 17, 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