Skip to content

feat(lab): NavigationStack — push/pop navigation that moves like UINavigationController - #8107

Draft
vjeux wants to merge 1748 commits into
meta:mainfrom
vjeux:uikit/c14-navigation-stack
Draft

vjeux wants to merge 1748 commits into
meta:mainfrom
vjeux:uikit/c14-navigation-stack

Conversation

@vjeux

@vjeux vjeux commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Depends on #8360 and #8562. Review only this PR's change.

User need

What led here: we are bringing Astryx's touch components to iOS quality on the mobile web. Phone layouts need iOS's drill-down navigation: each screen pushes the next, a back swipe follows the finger and can be cancelled, and a push can be grabbed mid-flight. AppShell and MobileNav switch sections; nothing in Astryx stacks screens.

Problem and solution fit

NavigationStack renders the app's path, one NavigationScreen per entry; covered screens stay mounted, scroll kept, but inert. Screens move like UIKit's: a measured push spring, bars that ride with their screens, and a back swipe from anywhere in the content, tracked 1:1 and finished by UIKit's release rule. Focus goes to the new title, and back to the pushing control after a pop.

Current specification

spec:AST-094: touch keys on a coarse primary pointer (FR13); a browser tab keeps its edge swipe (FR22), so the stack's runs only in a home-screen web app. Lab placement and API are proposed, for the owner's review.

Public delta and caller burden

Lab: NavigationStack, NavigationScreen, useNavigationStack; the caller passes path and onPathChange. Core: six measured uikit table entries, isRtlElement from its hooks, and the locale key @astryx.navigationStack.back.

Design and alternatives

  • View Transitions are not interruptible: a swipe cannot track a finger or grab a push.
  • Per-screen CSS transitions give no 1:1 tracking and no release rule.
  • Chosen: one progress value drives every layer through the compositor animator: a push and a swipe share one model, finger frames skip React, and motion survives a busy main thread.

Not here: large titles (#8185), row selection across a push (#8114), search (#8204).

Evidence

iOS 26.2 simulator: push, bar and back, slow swipe springs back, moving back cancels, back past its start, paused fast swipe finishes, flick, content swipe, 600 ms main-thread block, right-to-left, grabbed mid-push, pop to root. Chromium: edge swipe in a home-screen app, push during a push, a sideways strip, declined pop, keyboard focus, pop then swipe. Android 15 emulator: push and pop, content swipe, slow swipe, flick.

Scope

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Testing

In Chrome's device toolbar (a phone, touch), "Lab/NavigationStack › Settings":

  1. Tap General: its screen slides in from the right with its bar; Settings shifts left and dims.
  2. Drag from the left third and let go before halfway: it springs back. Past halfway, or a flick: it pops.
  3. Tap Back: it pops to Settings.
  4. With a mouse, the bar's Back is the way back.

What I ran: the unit tests and root typecheck passed; #8108's real-browser proofs passed in Chromium and WebKit.

Recorded on the iOS 26.2 simulator and the Android 15 emulator. Includes #8562 (Core's internal entry points); if those land differently, this follows.

@vercel

vercel Bot commented Oct 24, 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 Oct 29, 2026 10:58pm UTC

Request Review

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

astracat-bot Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Oct 29, 2026, 11:19 PM UTC

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approval is waiting on an owner decision. Draft spec:AST-094 is the only spec behind the lab NavigationStack and the two new experimental import paths, so an engineering owner needs to approve FR1–FR23, DEC-1 and DEC-2, together with the amendments it proposes to current records, by commenting /approve-spec 4038ef0c4221e2411422828cc7576237ef625899 on this pull request, or else name the record that should govern; the author may do so as an engineering owner. Whatever that decision, these changes are needed:

  • In a real browser, focus falls to the page body after every pop, because the stack tries to restore focus while the revealed screen is still inert.
  • The adaptive query change in useAdaptivePresentation.ts changes released menu and selector behavior against component:Selector DEC-1, and belongs in its own pull request.
  • The UIKit table's sourcing test fails on contentPopHysteresis, and CI rejects the ShadCN route lock and the CLI official package list, which both need regenerating.
  • Against main this is 27,062 authored lines; landing the stacked predecessors first would leave the 1,974-line NavigationStack commit.

[Automated review]

);
if (under != null) {
settle(under, 'top');
focusAfter('pop', top);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This runs right after setView(… leaving: null) but before React commits it, so the revealed screen is still inert and source.focus() does nothing; in Chromium focus ends on the body after Back, both from the keyboard and from a pointer. Restoring focus after the commit that clears inert, with a fallback to the revealed title, would keep the documented behavior.

* @source measured: UIKit lab (injected host app), iOS 26.2 simulator,
* iPhone 17 Pro, UINavigationController.contentSwipe began after 27–30 pt
* of travel for drags at or under 600 pt/s, Oct 23 2026
* @measure the exact threshold and the faster start: at 1000 pt/s the swipe

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

uikit.test.ts requires @measure M-<ID> with the ID listed in motion/MEASUREMENTS.md; this free-text tag fails "every value is sourced (law P2)" locally and in CI test-ui (1/4).

// and large touch displays stay anchored, phones in either orientation get
// the sheet. The query is the shared touch presentation's
// (utils/touchPresentation.ts).
export const COMPACT_TOUCH_PRESENTATION_QUERY = COMPACT_TOUCH_QUERY;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This swaps the surface released menus and selectors open: a coarse-pointer phone in landscape now gets a modal sheet, and a 744 px tablet in portrait an anchored popover. The current Selector record says adaptive keeps its width-and-pointer query, so this probably belongs in its own pull request with that owner's decision.

whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
outline: 'none',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

After a keyboard push, focus lands on this title, and with outline: 'none' nothing shows where it is; the interaction-modality architecture expects the shared focus indicator after keyboard input.

// Commit the pop; the transition it triggers continues from here
// at the finger's speed.
releaseRef.current = {velocity: v};
onPathChangeRef.current(pathRef.current.slice(0, -1));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If the app keeps path here (for example to guard unsaved edits), nothing springs the cards back, and the top card stays where the finger left it.

const previous = rendered[index - 1]?.element.props;
return (
previous?.backTitle ??
previous?.title ??

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

With ??, a previous screen titled "" gives Back an empty accessible name; the catalog's "Back" is meant for exactly that case.

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

Component Size

Component Import before Import after Delta CSS before CSS after Delta
core/AlertDialog 56.9KB 57.2KB +303B 12.4KB 12.4KB 0B
core/AppShell 57.9KB 58.1KB +250B 11.6KB 11.6KB 0B
core/AvatarGroup 39.8KB 39.8KB +10B 6.4KB 6.4KB 0B
core/AvatarGroupOverflow 39.9KB 40.2KB +314B 6.4KB 6.4KB 0B
core/Banner 47.8KB 48.1KB +299B 9.9KB 9.9KB 0B
core/BaseTypeahead 54.3KB 54.6KB +252B 9.9KB 9.9KB 0B
core/BottomSheet 34.0KB 34.0KB 0B 7.9KB 7.9KB 0B
core/BottomSheetSwitcher 14.8KB 14.8KB 0B 3.3KB 3.3KB 0B
core/BreadcrumbItem 66.4KB 66.7KB +312B 11.0KB 11.0KB 0B
core/Button 43.3KB 43.6KB +283B 9.2KB 9.2KB 0B
core/ButtonGroup 8.4KB 8.4KB 0B 3.3KB 3.3KB 0B
core/Calendar 54.9KB 55.2KB +298B 10.0KB 10.0KB 0B
core/Carousel 50.2KB 50.5KB +327B 10.2KB 10.2KB 0B
core/ChatComposer 60.6KB 60.9KB +280B 10.8KB 10.8KB 0B
core/ChatComposerInput 55.7KB 56.0KB +275B 10.1KB 10.1KB 0B
core/ChatComposerTokenElement 55.7KB 56.0KB +275B 10.1KB 10.1KB 0B
core/ChatDictationButton 46.5KB 46.8KB +274B 9.5KB 9.5KB 0B
core/ChatLayout 48.8KB 49.1KB +284B 9.9KB 9.9KB 0B
core/ChatLayoutScrollButton 46.4KB 46.6KB +264B 9.6KB 9.6KB 0B
core/ChatSendButton 45.8KB 46.1KB +274B 9.2KB 9.2KB 0B
core/CheckboxInput 49.9KB 50.2KB +281B 9.3KB 9.3KB 0B
core/CheckboxList 46.0KB 46.0KB +9B 8.1KB 8.1KB 0B
core/CheckboxListItem 54.0KB 54.3KB +295B 10.5KB 10.5KB 0B
core/ClickableCard 12.8KB 13.1KB +289B 6.9KB 6.9KB 0B
core/CodeBlock 60.5KB 60.8KB +285B 10.7KB 10.7KB 0B
core/Collapsible 11.7KB 12.0KB +291B 4.2KB 4.2KB 0B
core/CommandPalette 50.9KB 51.2KB +292B 11.8KB 11.8KB 0B
core/CommandPaletteItem 8.4KB 8.7KB +280B 3.5KB 3.5KB 0B
core/ComplexSelector 55.8KB 56.1KB +328B 10.6KB 10.6KB 0B
core/ContextMenu 77.7KB 78.0KB +283B 14.6KB 14.6KB 0B
core/ContextMenuItem 16.6KB 16.8KB +281B 5.2KB 5.2KB 0B
core/DateInput 99.9KB 100.1KB +252B 14.8KB 14.8KB 0B
core/DateRangeInput 69.4KB 69.6KB +276B 11.2KB 11.2KB 0B
core/DateTimeInput 110.1KB 110.3KB +258B 15.2KB 15.2KB 0B
core/DialogHeader 48.8KB 49.1KB +289B 9.8KB 9.8KB 0B
core/Drawer 31.6KB 31.6KB -2B 8.0KB 8.0KB 0B
core/DrawerHeader 48.9KB 49.2KB +259B 11.2KB 11.2KB 0B
core/DropdownMenu 72.7KB 73.0KB +288B 14.7KB 14.7KB 0B
core/DropdownMenuCheckboxItem 16.1KB 16.4KB +284B 5.6KB 5.6KB 0B
core/DropdownMenuItem 15.4KB 15.7KB +287B 5.2KB 5.2KB 0B
core/DropdownMenuRadioItem 16.2KB 16.5KB +275B 5.6KB 5.6KB 0B
core/DropdownMenuSubMenu 58.1KB 58.4KB +278B 9.5KB 9.5KB 0B
core/Field 44.2KB 44.2KB +11B 8.0KB 8.0KB 0B
core/FieldLabel 39.8KB 39.8KB +10B 6.5KB 6.5KB 0B
core/FileInput 54.1KB 54.4KB +272B 10.3KB 10.3KB 0B
core/IconButton 43.3KB 43.6KB +282B 9.2KB 9.2KB 0B
core/InputGroup 44.8KB 44.8KB +9B 8.0KB 8.0KB 0B
core/Item 11.4KB 11.6KB +273B 4.7KB 4.7KB 0B
core/LayerProvider 63.3KB 63.6KB +295B 10.1KB 10.1KB 0B
core/Lightbox 51.2KB 51.4KB +258B 9.8KB 9.8KB 0B
core/Link 43.5KB 43.8KB +297B 7.6KB 7.6KB 0B
core/ListItem 53.5KB 53.8KB +322B 10.5KB 10.5KB 0B
core/Markdown 144.5KB 144.7KB +257B 17.4KB 17.4KB 0B
core/MobileNav 51.0KB 51.3KB +272B 10.1KB 10.1KB 0B
core/MobileNavToggle 46.2KB 46.5KB +269B 9.4KB 9.4KB 0B
core/MoreMenu 72.9KB 73.2KB +289B 14.7KB 14.7KB 0B
core/MultiSelector 76.2KB 76.4KB +265B 14.6KB 14.6KB 0B
core/NavHeadingMenu 8.9KB 8.9KB 0B 3.2KB 3.2KB 0B
core/NumberInput 55.7KB 56.0KB +288B 10.7KB 10.7KB 0B
core/Outline 28.6KB 28.9KB +300B 4.0KB 4.0KB 0B
core/Pagination 87.7KB 88.0KB +272B 15.3KB 15.3KB 0B
core/Popover 49.8KB 50.1KB +246B 12.1KB 12.1KB 0B
core/PowerSearch 155.1KB 155.3KB +275B 18.6KB 18.6KB 0B
core/RadioList 45.6KB 45.6KB +9B 8.0KB 8.0KB 0B
core/RadioListItem 52.1KB 52.5KB +336B 9.7KB 9.7KB 0B
core/SegmentedControl 38.8KB 38.8KB +11B 6.3KB 6.3KB 0B
core/SegmentedControlItem 8.6KB 8.9KB +285B 3.9KB 3.9KB 0B
core/SelectableCard 12.8KB 13.1KB +294B 7.1KB 7.1KB 0B
core/Selector 79.1KB 79.4KB +294B 15.0KB 15.0KB 0B
core/SelectorOption 14.5KB 14.8KB +251B 5.1KB 5.1KB 0B
core/SideNav 58.0KB 58.3KB +275B 10.6KB 10.6KB 0B
core/SideNavCollapseButton 46.6KB 46.9KB +251B 9.5KB 9.5KB 0B
core/SideNavHeading 54.7KB 55.0KB +258B 10.1KB 10.1KB 0B
core/SideNavItem 54.5KB 54.8KB +276B 10.1KB 10.1KB 0B
core/Slider 48.5KB 48.5KB +10B 8.5KB 8.5KB 0B
core/Step 32.4KB 32.7KB +289B 5.3KB 5.3KB 0B
core/Stepper 47.4KB 47.7KB +274B 9.6KB 9.6KB 0B
core/Switch 48.4KB 48.7KB +294B 9.3KB 9.3KB 0B
core/Tab 9.7KB 10.0KB +294B 4.1KB 4.1KB 0B
core/TabList 40.2KB 40.2KB +12B 7.2KB 7.2KB 0B
core/TabMenu 51.6KB 51.9KB +284B 10.0KB 10.0KB 0B
core/Table 84.0KB 84.2KB +261B 15.1KB 15.1KB 0B
core/TableCell 78.8KB 79.1KB +277B 14.8KB 14.8KB 0B
core/TableHeaderCell 78.6KB 78.9KB +282B 14.8KB 14.8KB 0B
core/TableSelectionToolbar 52.4KB 52.6KB +286B 11.2KB 11.2KB 0B
core/TextArea 49.4KB 49.4KB +13B 9.4KB 9.4KB 0B
core/TextInput 53.5KB 53.8KB +291B 10.5KB 10.5KB 0B
core/Thumbnail 50.7KB 50.9KB +283B 11.0KB 11.0KB 0B
core/TimeInput 86.8KB 87.1KB +280B 13.8KB 13.8KB 0B
core/Timestamp 27.5KB 27.5KB +11B 9.5KB 9.5KB 0B
core/Toast 59.8KB 60.1KB +267B 9.7KB 9.7KB 0B
core/ToggleButton 44.1KB 44.4KB +252B 9.3KB 9.3KB 0B
core/Token 29.6KB 29.9KB +298B 4.5KB 4.5KB 0B
core/Tokenizer 64.8KB 65.1KB +316B 11.7KB 11.7KB 0B
core/Toolbar 39.8KB 39.8KB +12B 7.7KB 7.7KB 0B
core/TopNav 51.9KB 52.1KB +287B 10.4KB 10.4KB 0B
core/TopNavHeading 54.2KB 54.4KB +241B 9.9KB 9.9KB 0B
core/TopNavItem 9.0KB 9.3KB +283B 3.8KB 3.8KB 0B
core/TopNavMegaMenu 54.2KB 54.5KB +278B 10.8KB 10.8KB 0B
core/TopNavMegaMenuItem 9.1KB 9.4KB +281B 4.1KB 4.1KB 0B
core/TopNavMenu 53.6KB 53.9KB +268B 10.1KB 10.1KB 0B
core/TreeList 32.5KB 32.8KB +284B 4.7KB 4.7KB 0B
core/Typeahead 61.5KB 61.7KB +277B 11.3KB 11.3KB 0B
lab/NavigationScreen N/A 57.7KB N/A N/A 994B N/A
lab/NavigationStack N/A 57.7KB N/A N/A 994B N/A

Sizes are gzip. Import counts the JavaScript the import loads eagerly; CSS counts the package stylesheet rules referenced by the modules it can load from its own package, lazily loaded ones included.

Bundle Size Summary

Gzip figures measure each package's entry file, not the code an import pulls in.

Package Entry (ESM) Entry gzip before Entry gzip after Delta
@astryxdesign/core 4.9KB 1.2KB 1.2KB 0B
@astryxdesign/lab 4.8KB 1.9KB 2.0KB +73B
Package stylesheet Gzip before Gzip after Delta
@astryxdesign/core 34.6KB 34.6KB 0B
@astryxdesign/lab 11.1KB 11.3KB +178B

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

55 of 502 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Selector Indicator Space Bottom Sheet Narrow End RTL neutral light 753,933
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,072
RichTextEditor Markdown parity: side by side probe dark 558,840
RichTextEditor Markdown parity: side by side probe light 540,756
Chat Full AI Chat probe light 230,823
Chat Full AI Chat probe dark 229,805
AppShell With Mobile Nav probe light 217,010
AppShell With Mobile Nav probe dark 216,960
Collapsible Dividers probe dark 66,445
Collapsible Dividers probe light 66,445
AppShell Playground neutral dark 65,198
AppShell Playground neutral light 63,788
Chat Default neutral dark 36,304
Chat Default neutral light 35,767
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,406
Chat With Attachments probe dark 11,232

and 35 more.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approval waits on an engineering owner deciding whether the draft touch-presentation spec (AST-094: FR1–FR23, DEC-1 and DEC-2, with the amendments it proposes to current records) governs the new motion and gesture experimental subpaths, and which spec governs the lab NavigationStack's own API and focus behavior; an engineering owner records that decision by commenting /approve-spec 4771de31dc836de85c69c3314ae5fc05071362c1 on this pull request, and the author may do so if they are an engineering owner.

  • Please drop the adaptive presentation query change from this pull request, since it changes where five released menus and selectors open a bottom sheet against the current Selector spec.
  • After a pop, focus lands on the page body instead of the control that pushed the screen, so please restore it once the revealed screen is no longer inert.
  • Please add the @astryxdesign/cli Changeset the lint job asks for, give the focused bar title a visible focus indicator, and retarget once the predecessor pull requests land so the diff is the NavigationStack commit alone.

[Automated review]

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approval waits on an engineering owner deciding whether the draft touch-presentation spec (AST-094: FR1–FR23, DEC-1 and DEC-2, with the amendments it proposes to current records) governs the new motion and gesture experimental subpaths, and which spec governs the lab NavigationStack's own API, bar and focus behavior; an engineering owner records that decision by commenting /approve-spec 5743dabda58f55e296678b3f8b5d06f55c19106f on this pull request, and the author may do so as an engineering owner. Whatever that decision, these changes are still needed:

  • Please drop the adaptive presentation query change, which moves where released menus, selectors and their sub-menus open against the current Selector spec.
  • After a pop, focus lands on the page body instead of the control that pushed the screen, so please restore it once the revealed screen is no longer inert, and give the title focused after a keyboard push a visible focus indicator.
  • Please spring the cards back when the app declines a released swipe, fall back to the catalog "Back" for an empty previous title, and correct AST-094's citation of AST-090, which does not exist.
  • Please land the predecessor pull requests (or retarget) so this diff is the NavigationStack commit alone, and get a green lint run.

[Automated review]

follows.
- **FR7 — Exits animate as UIKit's do.** A touch presentation MUST play the
exit its UIKit counterpart plays. **Proposed; pending owner review:** this
departs from the draft `spec:AST-090` FR1 (exits off by default) and FR10

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

spec:AST-090 is not on main (no record, no reference), so FR7 departs from a record the approver cannot read; the same citation repeats in Current-state impact. Either name the record that exists, or drop the departure until it lands.

return;
}
}
layersOf(key)?.titleElement?.focus({preventScroll: true});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

On a pop this is called with the popped screen's key (focusAfter('pop', top)), so the fallback focuses the leaving screen's own title, which is still inert and about to unmount. The fallback probably wants the revealed screen (under), focused after the commit that clears inert.

@vjeux
vjeux force-pushed the uikit/c14-navigation-stack branch from 5743dab to 0ac171f Compare October 24, 2026 16:57
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 24, 2026
… pops to the root

A push removes the covered screen's title 0.54 s in; the new proof blocks
the main thread for 900 ms from the push's first frame and checks the title
is gone on time (it lingered until the block ended before meta#8107's fix).

The stories' screens with nothing deeper get a Done row that pops back to
the root in one transition, so the multi-level pop can be filmed.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This needs an engineering owner's decision before it can be approved: draft spec:AST-094 (FR1-FR23, DEC-1, DEC-2) is unapproved, and no record yet governs NavigationStack's own API, bar and focus behaviour, or where experimental subpaths that no component owns should live under spec:AST-017 FR21. An engineering owner can record that decision by commenting /approve-spec 0ac171f6f19169a4a57ab4f43dd7fa60b86a996b on this pull request, and the author may do so as an engineering owner. Independently of that decision, these need changes:

  • Focus is lost to the page after every pop, and the pushed title shows no focus indicator after keyboard input (NavigationStack.tsx:927-932, :238).
  • The content back swipe takes rightward drags away from nested horizontal scrollers, and a declined swipe leaves both screens frozen mid-pop (NavigationStack.tsx:1157-1176, :1098-1102).
  • The presentation="adaptive" query change contradicts Selector.spec.md DEC-1 and belongs in its own pull request, and at 28,054 authored lines the stack should land as separate pull requests.

[Automated review]

);
if (under != null) {
settle(under, 'top');
focusAfter('pop', top);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This runs before React commits leaving: null, so every layer is still inert and source.focus() is a no-op: after Back, focus ends on the page body. Move focus after the commit that clears leaving, and fall back to the revealed screen's title rather than the popped one.

whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
outline: 'none',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

outline: 'none' hides the focus that a keyboard push moves to this title (it matches :focus-visible); interaction-modality INV1 says programmatic focus after keyboard input shows the shared indicator.

Comment on lines +1160 to +1163
new PanGestureRecognizer({
name: 'NavigationStack.contentBackSwipe',
direction: 'right',
hysteresis: CONTENT_CLAIM_PX,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A one-way pan without scrollEdge claims the touch after 5 px without checking nested scrollers, so a horizontally scrolled carousel inside the screen can no longer be dragged back toward its start. scrollEdge: true with claimDistance: null lets it begin only when nothing under the finger can scroll right.

Comment on lines +1101 to +1102
releaseRef.current = {velocity: v};
onPathChangeRef.current(pathRef.current.slice(0, -1));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If the app declines this path change, nothing resets the layers: both screens stay where the finger left them and releaseRef stays armed for the next pop. Spring back as a cancel when the path has not changed by the next render.

@vjeux
vjeux force-pushed the uikit/c14-navigation-stack branch from 0ac171f to 8af05a6 Compare October 24, 2026 17:47
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 24, 2026
… pops to the root

A push removes the covered screen's title 0.54 s in; the new proof blocks
the main thread for 900 ms from the push's first frame and checks the title
is gone on time (it lingered until the block ended before meta#8107's fix).

The stories' screens with nothing deeper get a Done row that pops back to
the root in one transition, so the multi-level pop can be filmed.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This needs an engineering owner's decision before it can be approved: draft spec:AST-094 (FR1-FR23, DEC-1, DEC-2) is unapproved at this head, its FR4 says touch physics are not themable while this head adds theme motion roles that retune them, and no record yet governs NavigationStack's own API, bar and focus behaviour. An engineering owner records the decision by commenting /approve-spec 8af05a61875de26eb7ba9cc15b32652bad39348f on this pull request, and the author may do so if they are an engineering owner; if the theme roles are the intended direction, FR4 and DEC-1 need rewriting first. Independently of that decision, these need changes:

  • Focus is lost to the page after every pop, and the pushed title shows no focus indicator after keyboard input (NavigationStack.tsx:936-941, :240).
  • The presentation="adaptive" query change swaps the popover and the sheet in five released components against the Selector record's DEC-1, so it belongs in its own pull request.
  • CI test-node (1/4) fails because the CLI's stable-output golden for the motion docs topic was not regenerated after the NavigationStack commit.
  • The content back swipe takes rightward drags from nested horizontal scrollers, and a declined swipe leaves both screens frozen (NavigationStack.tsx:1174-1187, :1107-1111).
  • At 30,121 authored lines, the motion, gesture, theme-role and harness foundations should land as their own pull requests.

[Automated review]

measures (0.55 for a scroll view and a sheet), and a release MUST pick its
rest point by projecting its velocity the way its UIKit counterpart does:
with a deceleration rate, or with a measured projection time.
- **FR4 — Physics are not themable in touch presentations.** A touch

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

FR4 says a touch presentation reads its motion from the table on every theme, but this head lets themes retune it: the animator resolves every table spring under the element's theme (packages/core/src/motion/animator.ts:1301-1303), and defineTheme({motion}) takes springs, durations and curves. One of the two has to change so the record an owner approves describes what ships; DEC-1's rejection of per-theme tuning and the FR4 verification row would change with it.

Comment thread packages/core/src/theme/defineTheme.ts Outdated
* ```
*/
motion?: MotionScaleConfig;
motion?: MotionConfig;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This widens the stable DefineThemeInput.motion under a [feat] Changeset, with keys that are paths into the experimental uikit table, which may be renamed in a patch release. expandMotionRoles accepts an id nothing registers, so a renamed role would silently stop applying in a released theme. spec:AST-017 FR21 keeps a surface like this behind a marked experimental boundary.

* is everything else. Pair `ios` with `pointer: 'coarse'` for a touch
* profile, such as touch motion tuned per platform.
*/
platform?: 'ios' | 'other';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The theme-authoring-contract record's change coupling says an adaptation change preserves the fixed condition vocabulary; adding platform changes that vocabulary, so it needs the record amended and an owner's decision first.

vjeux added 27 commits October 28, 2026 11:17
…bute

From the review of meta#8076: the README said paintPress in
utils/pressFeedback.ts is the one writer of data-astryx-press, but the
action-group tracker on main (meta#8346) writes its groups' presses itself.
The sentence now says what holds at this head.
meta#8076's new head carries main 70ea859 with meta#8073's writer of the press
attribute on main's press controller, and its README names both writers.
utils/pressFeedback.ts keeps that controller with this line's own changes
on it: the pointer, drag, scroll and visibility listeners through the
shared input stream (meta#8356) and touchcancel only while the primary pointer
is coarse (meta#8270); the key path stays at the window's bubble phase, so a
Space press the page cancels paints nothing. usePressTracker stays in its
own module, one tracker for a component's life (meta#8315), so meta#8073's
rebuilt-tracker hook and its test are not taken. The harness files are
meta#8076's.
…s, and the action-group tracker writes its own

The header and writePress called it the one writer of the press attribute,
but main's action-group tracker writes its groups' presses itself. They now
say what holds, as meta#8076's gestures README does.
…he press attribute

The release note said every press painter writes data-astryx-press
through one internal writer, but the action-group tracker
(hooks/actionGroupTracker.ts) writes its groups' presses itself, as the
gestures README and utils/pressFeedback.ts already say. The note now says
paintPress writes every press it tracks and the action-group tracker
writes its own.
…llowance under every primary pointer

The useMenuPress record's FR9 puts the trigger's held finger under
spec:AST-094 FR29 under every primary pointer (FR43), so a finger on a
touchscreen laptop may drift 13 pt before the open, as on a phone. The
trigger read (pointer: coarse) as its press started and took the long
press's 10 px where the pointer was fine. Three cases fail until it does
not: a 12 pt drift opens under a fine pointer too, a (12, 12) settle
opens there, and nothing reads a pointer query, the trigger's press
included.
…lowance under every primary pointer

The useMenuPress record's FR9 governs the trigger's held finger by
spec:AST-094 FR29 under every primary pointer (FR43). The trigger now
hands the long press FR29's 13 px drift allowance whatever the primary
pointer, so it no longer reads (pointer: coarse) as its press starts, and
the menus drop their coarsePointer import. ContextMenu keeps the long
press's own allowable movement. The changeset says the same.
Strict ESLint reported six unused bindings in files this pull request
carries: the host's HAPTIC_SWITCH_ATTRIBUTE import, two unused imports
in the pan's tests (scrollProbe, ScreenEdgePanGestureRecognizer), the
swipe test's drift, the presented-hit-testing test's gestures, and a
GestureHost test's before, which now asserts what it was read for: a
second finger's moves leave the pan where it was.
…eal angular speed

The release velocity of a rotation whose listener sets rotation = 0 on
each change, at 2 degrees every 16 ms, read 4.363 rad/s against the
2.182 rad/s of the same stream without a re-base: the test asserted only
more than 1.5. It now asserts the 2.18 rad/s (spec:AST-100 FR2), and
fails.
The rotation's velocity tracker samples the raw unwrapped angle, which
setting rotation does not move, so the setter's shift of the samples read
each re-base as extra turn and doubled the release velocity of a
listener that re-bases on every change. The setter no longer touches the
tracker.
…mates while it runs

The proof read the element's animations 230 ms in, after the dip had
ended, and asserted only that every animated key is opacity, which an
empty list passes: with the cross-fade removed from the plan (the move
still landing), the proof still passed. It now reads the keyframe keys
right after the call starts and asserts they include opacity and nothing
else; the same mutant fails it. Chromium and WebKit pass. (F1's in-flight
read from c648034.)
…roller, and its claimed moves are cancelled under pointer events

Two comparisons stop at the shadow boundary, each failing a case:
- once the host's listener on a recognizer's inner node has seen the
  finger, isFingerDownIn reads it as outside a light-DOM scroller around
  that root, so a scroll under it is not the finger's (FR20);
- under inputMode 'pointer-events', a claimed pan on a shadow host
  cancels none of its finger's moves over the inner content, since the
  finger's target is the inner node and its touches reach the host
  retargeted (FR19).
…the flat tree

isFingerDownIn and the pointer-events finger match compare with
containsAlongFlatTree, as the scroll watch already does: a finger on
content inside an open shadow root is down in the scroller around that
root, and its touches, retargeted to the shadow host, match its pointer
finger, so a claimed pan cancels its moves there (spec:AST-094 FR19,
FR20).
…achments asks, and only then

The host let the last attachment decide whether an element is an action
group (useGestureRecognizer always passes the option), and never
recomputed it at a detach: a plain attachment after the group's turned
the group off, and a group's attachment released left a recognizer that
never asked taking presses under a fine pointer. Fails until the host
counts the attachments that ask.
…ents asks

The host counts the attachments that pass actionGroup: true and keeps the
element a group while one remains, recomputed at each detach. An
attachment that passes false, as useGestureRecognizer does by default,
no longer turns a group off, and a group's last asking attachment taking
its leave ends the group.
… that content

The presented hit test takes the document's elementFromPoint, which
answers a shadow host for anything inside its open root, and compares
with Node.contains, which stops at the boundary: a recognizer on a
control inside a moving sheet's shadow root gets no finger, and the tap's
click goes to the host. Fails until the hit test descends into open roots
and compares along the flat tree.
Where a moving element is drawn away from its layout box, the host
hit-tests what is drawn under the finger with the document's
elementFromPoint, which answers a shadow host for anything inside its
open root. The hit test now descends through each open root's own
elementFromPoint and compares with the movers along the flat tree, so a
recognizer on a control inside a moving sheet's shadow root gets its
finger and the tap clicks that control.
…nt lets go

The host's touch-action rules sit in an adopted sheet or a style element
per document or shadow root, and were never removed, so a page whose
last recognizer detached kept them, against spec:AST-094 FR24 (nothing
touch-related remains after the last instance unmounts). Fails until a
root's rules go with its last marked element.
…th its last marked element

The touch-action writer records which elements it marked in each
document or shadow root, and when the last one is unmarked (its last
recognizer detached) it removes that root's adopted sheet or style
element, so nothing touch-related remains after the last instance
unmounts (spec:AST-094 FR24). A later mark writes the rules again; an
element marked in another root first lets go of the old one.
… the inline style it reads

- The motion registry, the host's engine gate and the README name the
  presented hit test as an engine workaround (spec:AST-013 FR6) with its
  review condition (re-measure on each iOS release; remove it once iOS
  WebKit hit-tests a compositor-moved element where it is drawn) and its
  regression fixture.
- While a curve runs the animator holds the value it starts from inline,
  so presentation.ts and the README no longer say the inline style holds
  the end.
…core/internal/touch

Core ships the internal entry @astryxdesign/core/internal/touch, which
re-exports the gesture primitives for Astryx's own packages, and the
Lab-import guard fails a Lab import of core outside core's exports
(architecture:react-component-runtime INV13). The README and the barrel's
header named internal workspace imports and said nothing here is
exported; they now name that entry.
…ill needs the element, and the listeners that cancel

The release note, the stream's header, the host's comment and the README
said the stream is one passive listener per event type and that a
document-capture stopPropagation no longer starves the recognizers. Such a
stop never hid a listener on the same node, and some subscriptions cancel.
They now say what changed: an app's window-capture stopPropagation, or a
document-capture stopImmediatePropagation registered before core, no
longer hides a touch; a recognizer that must claim still needs the touch to
reach its element; the gesture host's touchend, click and contextmenu
cancel while a claimer is attached and the page hold's touchmove while it
holds; and the stream stays ahead of an app's window-capture listener only
until a type's listener is re-added. The README's list of blocking
touchmove listeners gains the claimed touch's target and the document
while a claiming element moves.
…default it moves

The {stylexOptions} form of astryxStylex now passes StyleX
treeshakeCompensation: true unless the caller sets it. spec:AST-017 FR3
asks the release note to name the old and new default and the option
that restores the old one; it now does.
…er and for the two stops the input stream fixes

- A still finger with sub-pixel jitter over a scroll view keeps its tap
  and scrolls nothing (spec:AST-094 FR18–FR22).
- A tap is still recognized under an app's window-capture
  stopPropagation, and under a document-capture
  stopImmediatePropagation registered before core's: the recognizers hear
  touches on the window's capture phase.
Chromium and WebKit pass.
…s once

Where nothing that claims is attached, the host's touchend listener is
passive and cannot cancel the engine's own click after a retargeted tap
clicks what is drawn. The shared click guard swallows that late click
whatever is attached; this case pins it, as asked on meta#8293.
…esture host's subscriptions

The gesture host subscribes no click: the one cancelling click subscriber
is the click guard's, added at a window's first arm and kept. The release
note, the stream's header and the gestures README listed click with the
host's touchend and contextmenu; they now name the guard's own.
meta#8360 now carries meta#8076 and meta#8320, which this branch took before.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approval is waiting on an engineering owner's decision: no current spec governs the Lab NavigationStack (its API, bar, back swipes and focus behaviour, and the motion roles spec:AST-094 FR4 asks a component record to name for its five navigation springs), or the new stable isRtlElement export from @astryxdesign/core/hooks, which spec:AST-017 FR21 would keep internal. An engineering owner can record that decision by commenting /approve-spec 2cb97c4858b381e1af9f395fc407af4a9cede7d0 on this pull request; the author may do so as an engineering owner. Whatever the decision, these need changes:

  • The back swipe averages the last three pan velocities and ignores the velocity's sign, so it can pop after a pause or while moving back (spec:AST-100 FR2/FR3, spec:AST-094 FR37).
  • After a click or tap on a row's text, a pop to the root leaves focus on the page body, because the recorded source is the row's label rather than its button.
  • A content swipe first moves the screen about 11 px against the finger at the pan's claim, and a runtime change of writing direction stops it from popping.
  • 27,558 of the 30,007 authored lines come from the unmerged dependency stack (#8360, #8562); landing that first lets this pull request be reviewed on its own.

[Automated review]

const recent = swipe.velocities.slice(
-navigation.interactivePopVelocitySamples,
);
v = recent.reduce((sum, value) => sum + value, 0) / recent.length;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The mean of the last three readings is a second velocity estimate: after a still pause the pan reads 0 at the lift, but readings of 2, 2 and 0 widths/s average 1.33, so a lift at 30 % pops (0.3 + 0.35 × 1.33 = 0.77). spec:AST-100 FR2 says a still finger reads 0 and "none reads another estimate", and FR3 that "a component never derives a second velocity to compare against". Pass popVelocity(recognizer.velocity().x, width, direction) at the lift and drop the buffer.

Comment on lines +125 to +129
return (
progress +
navigation.interactivePopFinishProjection * velocityWidthsPerSecond >
navigation.interactivePopFinishThreshold
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This commits a release that is moving back whenever the projection stays above half: shouldFinishPop(0.8, -0.5) is 0.625. spec:AST-094 FR37: "A release whose velocity points back toward the start MUST cancel, whatever the travel so far." Return false for a negative velocity before projecting, and add a [0.8, -0.5, false] row to the test table.

const rememberActivation = useCallback((event: SyntheticEvent) => {
if (event.target instanceof Element) {
lastActivationRef.current = {
target: event.target,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

event.target is often not the control: a click or tap on a row's text lands on the label inside ListItem's button, and on the pop focus() on it does nothing, so focus stays on body (reproduced in Chromium: click General's text, then Back, and document.activeElement is BODY). Record the closest focusable ancestor, and fall back to the revealed title when focus does not land.

(direction === 'rtl' ? -1 : 1) * recognizer.translation().x;
// Back past where it started, the screen follows with resistance
// (progressFromTravel).
const travel = along - deadZone;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Inside the 17 px dead zone this travel is negative, and progressFromTravel rubber-bands it, so the screen moves against the finger: with real touch input in Chromium it jumped to −11.36 px at 11 px of travel and was back at 0 only at 27 px. Hold travel inside the dead zone at 0, for example along >= deadZone ? along - deadZone : Math.min(0, along).

Comment on lines +244 to +247
useLayoutEffect(() => {
content.direction =
stackRef.current?.direction() === 'rtl' ? 'left' : 'right';
}, [content, stackRef]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

content and stackRef never change, so this runs once. After dir="rtl" was set on the stack at runtime, neither a leftward nor a rightward content swipe popped in Chromium (design:bidirectionality DR13). Set the direction from stack.direction() when each touch begins, for example in shouldReceiveTouch.

layers?.barDim?.stop();
}
runningRef.current = null;
return width > 0 ? Math.abs(x) / width : 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Math.abs drops the sign of the presentation value: a finger that catches the return from a release past the start (x < 0 in LTR) continues from +|x|, a jump of 2|x|. spec:AST-094 FR6 asks for a catch "at the value on screen". Return the signed progress, (direction === 'rtl' ? -x : x) / width.

name: 'isInteractivePopEnabled',
type: 'boolean',
description:
"Whether the back swipe pops: a sideways drag anywhere in the content, and in a web app opened from the home screen also a swipe from the leading screen edge. In a browser tab that edge stays the browser's own back swipe. The back swipe is an iOS gesture: on other touch devices (Android's system back owns both screen edges) and with a mouse, Back is the bar's button.",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The content swipe runs under any coarse primary pointer, Android included (NavigationStackTouch.ts:18-20, :241), so "on other touch devices … Back is the bar's button" is wrong for Android. Describe the content swipe on every touch device and the edge swipe only in a home-screen web app.

// Past the start the screen follows at a share of the finger, as UIKit's
// does (`navigation.interactivePopRubberBand`, measured in batch 62);
// never past the far edge.
return p < 0 ? p * navigation.interactivePopRubberBand : Math.min(1, p);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

spec:AST-094 FR3 asks a drag past an edge to resist with UIKit's rubber band (1 − 1 ÷ (x·c ÷ d + 1))·d; a flat 0.71 moves a 120.6 px overshoot on a 402 px stack 85.6 px instead of 70.6 px. Core's rubberBand, already re-exported from internal/motion, with c = 0.71 and d = the width, keeps the measured coefficient.

Comment on lines +130 to +131
const width = stack.width();
const direction = stack.direction();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

These read clientWidth and the computed direction on every finger move, and setProgress reads both again; spec:AST-094 FR9 allows "no layout read after the gesture begins". Read both once at began and keep them on swipeRef.

This branch was successfully deployed

1 active deployment
Preview — 2cb97c48 Deployed Oct 29, 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. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants