Skip to content

fix(Item): swipe actions move on the compositor with UIKit springs - #8097

Draft
vjeux wants to merge 1724 commits into
meta:mainfrom
vjeux:uikit/c12-swipe-compositor
Draft

vjeux wants to merge 1724 commits into
meta:mainfrom
vjeux:uikit/c12-swipe-compositor

Conversation

@vjeux

@vjeux vjeux commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Depends on #8096. Review only this PR's change: vjeux/astryx@40530da...7fb1ae9

Why

A released swipe-action row (Item, ListItem) stopped dead and restarted on a fixed 200 ms ease-out. On a busy page its panel stalled, then jumped; a finger on a moving row was ignored; and a flick fired the outermost action, often Delete.

What led to it

Part of a series bringing Astryx's touch interactions to parity with native iOS (UIKit). A CSS transition drove the release, dropping the finger's speed, and the panel animated its width on the main thread, so any script work froze it.

Options and tradeoffs

  1. Tune the transition: it still drops the speed and freezes.
  2. A JavaScript spring per frame: keeps the speed but freezes on a busy main thread.
  3. Compositor animations on UIKit's spring, re-aimed on every move from the row's position and speed (chosen): it keeps moving through a blocked main thread, and a finger can catch it. Costs: Item's import grows from 30.0 to 42.0 KB gzip, and the row moves by translate, not the custom property spec:AST-057 FR2 names.

Owner decisions proposed: that FR2 change, and the release rule (FR5, asked in #8134).

Why this choice

Only option 3 keeps the finger's speed through a busy page, within 0.07 px of UIKit's spring.

How to check it

On a phone, open the Item story "Swipe Actions":

  1. Drag a row and let go past halfway: it glides open, carrying the finger's speed.
  2. Flick a short drag open, then back: it opens, then closes; nothing fires.
  3. Touch a row while it is still moving: it stops under the finger and follows it.
  4. Touch a settling row and lift at once: it finishes settling and still closes on Escape.
  5. Drag a row far past its buttons and let go: the outermost action fires.
  6. With Reduce Motion on, release a row: it fades into place instead of sliding.

We ran these with real touch in Chromium and on the iOS 26.2 simulator and the Android 15 emulator; each behaved as listed (recordings below). The unit tests pass, and the browser tests (pnpm test:interaction ItemSwipeActions) match UIKit's spring frame by frame in Chromium and WebKit, also with the main thread blocked.

Evidence

iOS 26.2 Safari, main thread blocked 700 ms after the lift (black bar): the row keeps sliding.

Chromium, real touch: one frame per touch event.

Android 15: a slow release past halfway opens; a flick back closes.

Known red until #8671 merges: its touch-bundle check, which a gesture-using Item fails by design.

Scope

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

@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:39pm UTC

Request Review

@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:08 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 waits on an engineering owner's decision: this pull request intentionally changes the current row-actions spec (AST-057 FR5, so a flick opens the row instead of firing its outermost action, and FR2/DEC-5, so the row moves by compositor translate animations instead of a travel custom property), and it adds unapproved requirements to the current Item record (FR9 to FR13, DEC-3/DEC-4) and the new draft AST-094, including keeping swipe motion under Reduce Motion. An engineering owner records that decision by commenting /approve-spec e71f692b6c15a90f3d10adbf4ff781a39f447fa2 on this pull request (the author may do so if they are an engineering owner), and the AST-057 text needs the matching amendment, here or on main, before the change conforms to it. Independently of that decision, please address these:

  • The diff carries the whole stack (27,969 authored lines, and the last commit alone is 2,052), so land the predecessors and bring what remains under 2,000 lines or explain why it cannot be split.
  • .changeset/item-grid-row.md ships a role="row" change that existing callers must adapt to as a patch [feat]; it needs a [breaking] changeset in a declared minor (AST-017 FR32).
  • .changeset/item-swipe-gesture-system.md says where a release lands is unchanged, which item-swipe-uikit-motion.md and the head contradict, and packages/core/src/gestures/README.md documents a utils/touchPresentation.ts that does not exist.

[Automated review]

Comment thread .changeset/item-grid-row.md Outdated
@@ -0,0 +1,7 @@
---
'@astryxdesign/core': patch

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 note says existing role="row" callers now find an anchor or button in the label cell and must set its tabIndex through controlProps. A change that needs a caller edit is [breaking] under AST-017 FR32 and belongs in a declared minor, not a patch [feat].

Comment thread .changeset/item-swipe-gesture-system.md Outdated
'@astryxdesign/core': patch
---

[fix] Swipe actions on `Item` and `ListItem` run on the gesture system. A row claims a sideways touch at 8 px, before a browser commits to scrolling it, and its swipe begins at UIKit's 25 px, from 0, so a short wobble no longer moves the row. A second finger before the claim leaves the touch to the browser's pinch, and after it is ignored. The click a browser synthesizes after a swipe is cancelled at its source instead of being swallowed by a 400 ms timer. The row's motion and where a release lands are unchanged.

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 row's motion and where a release lands are unchanged" contradicts item-swipe-uikit-motion.md (a flick no longer fires) and the head: a 200 px, 2 s drag that deletes the row on the base only opens it here. Please drop the sentence and describe the change once.

if (behavior === 'commit') {
return 'closed';
}
if (velocity >= swipeActions.releaseVelocity) {

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 this rule no release velocity fires an entry; current AST-057 FR5 says a fling MUST fire the outermost entry under both models. This stays a spec contradiction until an engineering owner amends FR5.

## Touch presentation

Whether a component presents itself the touch (UIKit) way is answered once,
in `../utils/touchPresentation.ts`:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

../utils/touchPresentation.ts (and TOUCH_QUERY, COMPACT_TOUCH_QUERY, useTouchPresentation()) does not exist at this head; please drop this section until that module lands.

@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's decision: this pull request intentionally changes the current row-actions spec (AST-057 FR5, so a flick opens or closes the row instead of firing its outermost action, and FR2/DEC-5, so the row moves by compositor translate animations instead of a travel custom property), and it adds unapproved requirements to the current Item record (FR9 to FR13, DEC-3/DEC-4) and the new draft AST-094, including keeping swipe motion under Reduce Motion. An engineering owner records that decision by commenting /approve-spec 24e66ab7a6465f6e9491dc738eec748495b76636 on this pull request (the author may do so if they are an engineering owner), and the AST-057 text needs the matching amendment, here or on main, before the change conforms to it. Independently of that decision, please address these:

  • The diff carries the whole stack (27,997 authored lines, and the last commit alone is 2,080), so land the predecessors and bring what remains under 2,000 lines or explain why it cannot be split.
  • .changeset/item-grid-row.md ships a role="row" change that existing callers must adapt to as a patch [feat]; it needs a [breaking] changeset in a declared minor (AST-017 FR3, FR31).
  • .changeset/item-swipe-gesture-system.md says where a release lands is unchanged, which item-swipe-uikit-motion.md and the head contradict, and packages/core/src/gestures/README.md documents a utils/touchPresentation.ts that does not exist.

[Automated review]

Comment thread .changeset/item-grid-row.md Outdated
@@ -0,0 +1,7 @@
---
'@astryxdesign/core': patch

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 note says existing role="row" callers now find an anchor or button in the label cell and must set its tabIndex through controlProps. A change existing callers must adapt to is an incompatible delta of documented interaction and accessibility behavior (AST-017 FR3), and FR31 maps each one to a [breaking] changeset in a declared minor, not a patch [feat].

Comment thread .changeset/item-swipe-gesture-system.md Outdated
'@astryxdesign/core': patch
---

[fix] Swipe actions on `Item` and `ListItem` run on the gesture system. A row claims a sideways touch at 8 px, before a browser commits to scrolling it, and its swipe begins at UIKit's 25 px, from 0, so a short wobble no longer moves the row. A second finger before the claim leaves the touch to the browser's pinch, and after it is ignored. The click a browser synthesizes after a swipe is cancelled at its source instead of being swallowed by a 400 ms timer. The row's motion and where a release lands are unchanged.

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 row's motion and where a release lands are unchanged" contradicts item-swipe-uikit-motion.md (a flick no longer fires) and the head: a 140 px flick and a 200 px drag delete Message 1 on the base and leave it open on the head. Please drop the sentence and say once what changed about where a release lands.

Comment on lines +51 to +63
if (travel >= commitAt) {
return 'perform';
}
if (behavior === 'commit') {
return 'closed';
}
if (velocity >= swipeActions.releaseVelocity) {
return 'open';
}
if (velocity <= -swipeActions.releaseVelocity) {
return 'closed';
}
return travel >= swipeActions.openFraction * openWidth ? 'open' : 'closed';

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 this rule no release velocity fires an entry, and a row released past the panel's width while moving back closes; current AST-057 FR5 says a fling MUST fire the outermost entry under both models and a release past the panel's width MUST rest open. This stays an owner decision on amending FR5 rather than a change request.

## Touch presentation

Whether a component presents itself the touch (UIKit) way is answered once,
in `../utils/touchPresentation.ts`:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

../utils/touchPresentation.ts (and TOUCH_QUERY, COMPACT_TOUCH_QUERY, useTouchPresentation()) does not exist at this head; please drop this section until that module lands, or land it with the README.

@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

Modified Components

Item (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Entry File (ESM) 284B 284B 0B
Lines of Code 1372 1452 -
Complexity Very High Very High (106) -

Component Size

Component Import before Import after Delta CSS before CSS after Delta
core/AlertDialog 56.9KB 57.2KB +294B 12.4KB 12.4KB 0B
core/AppShell 57.9KB 58.1KB +242B 11.6KB 11.6KB 0B
core/AvatarGroupOverflow 39.9KB 40.2KB +303B 6.4KB 6.4KB 0B
core/Banner 47.8KB 48.1KB +289B 9.9KB 9.9KB 0B
core/BaseTypeahead 54.3KB 54.6KB +251B 9.9KB 9.9KB 0B
core/BreadcrumbItem 66.4KB 96.7KB +30.3KB ⚠️ 11.0KB 11.0KB -46B
core/Button 43.3KB 43.5KB +273B 9.2KB 9.2KB 0B
core/Calendar 54.9KB 55.2KB +290B 10.0KB 10.0KB 0B
core/Carousel 50.2KB 50.5KB +316B 10.2KB 10.2KB 0B
core/ChatComposer 60.6KB 60.9KB +270B 10.8KB 10.8KB 0B
core/ChatComposerInput 55.7KB 56.0KB +264B 10.1KB 10.1KB 0B
core/ChatComposerTokenElement 55.7KB 56.0KB +264B 10.1KB 10.1KB 0B
core/ChatDictationButton 46.5KB 46.8KB +264B 9.5KB 9.5KB 0B
core/ChatLayout 48.8KB 49.1KB +273B 9.9KB 9.9KB 0B
core/ChatLayoutScrollButton 46.4KB 46.6KB +255B 9.6KB 9.6KB 0B
core/ChatSendButton 45.8KB 46.1KB +265B 9.2KB 9.2KB 0B
core/CheckboxInput 49.9KB 50.2KB +273B 9.3KB 9.3KB 0B
core/CheckboxListItem 54.0KB 84.1KB +30.1KB ⚠️ 10.5KB 10.4KB -115B
core/ClickableCard 12.8KB 13.1KB +289B 6.9KB 6.9KB 0B
core/CodeBlock 60.5KB 60.8KB +278B 10.7KB 10.7KB 0B
core/Collapsible 11.7KB 12.0KB +291B 4.2KB 4.2KB 0B
core/CommandPalette 50.9KB 51.2KB +289B 11.8KB 11.8KB 0B
core/CommandPaletteItem 8.4KB 8.7KB +280B 3.5KB 3.5KB 0B
core/ComplexSelector 55.8KB 56.1KB +318B 10.6KB 10.6KB 0B
core/ContextMenu 77.7KB 108.1KB +30.4KB ⚠️ 14.6KB 14.5KB -88B
core/ContextMenuItem 16.6KB 46.5KB +29.9KB ⚠️ 5.2KB 5.1KB -98B
core/DateInput 99.9KB 100.1KB +243B 14.8KB 14.8KB 0B
core/DateRangeInput 69.4KB 69.6KB +266B 11.2KB 11.2KB 0B
core/DateTimeInput 110.1KB 110.3KB +248B 15.2KB 15.2KB 0B
core/DialogHeader 48.8KB 49.1KB +280B 9.8KB 9.8KB 0B
core/DrawerHeader 48.9KB 49.2KB +249B 11.2KB 11.2KB 0B
core/DropdownMenu 72.7KB 102.4KB +29.7KB ⚠️ 14.7KB 14.7KB -83B
core/DropdownMenuCheckboxItem 16.1KB 46.0KB +29.8KB ⚠️ 5.6KB 5.5KB -93B
core/DropdownMenuItem 15.4KB 45.1KB +29.7KB ⚠️ 5.2KB 5.1KB -98B
core/DropdownMenuRadioItem 16.2KB 46.0KB +29.8KB ⚠️ 5.6KB 5.5KB -93B
core/DropdownMenuSubMenu 58.1KB 87.8KB +29.7KB ⚠️ 9.5KB 9.4KB -89B
core/FileInput 54.1KB 54.4KB +262B 10.3KB 10.3KB 0B
core/IconButton 43.3KB 43.6KB +273B 9.2KB 9.2KB 0B
core/Item 11.4KB 41.0KB +29.6KB ⚠️ 4.7KB 4.6KB -107B
core/LayerProvider 63.3KB 63.6KB +288B 10.1KB 10.1KB 0B
core/Lightbox 51.2KB 51.4KB +249B 9.8KB 9.8KB 0B
core/Link 43.5KB 43.8KB +288B 7.6KB 7.6KB 0B
core/List 6.7KB 6.7KB 0B 3.4KB 3.4KB 0B
core/ListItem 53.5KB 83.5KB +30.1KB ⚠️ 10.5KB 10.4KB -115B
core/Markdown 144.5KB 174.8KB +30.4KB ⚠️ 17.4KB 17.2KB -125B
core/MobileNav 51.0KB 51.3KB +264B 10.1KB 10.1KB 0B
core/MobileNavToggle 46.2KB 46.5KB +259B 9.4KB 9.4KB 0B
core/MoreMenu 72.9KB 102.6KB +29.7KB ⚠️ 14.7KB 14.7KB -83B
core/MultiSelector 76.2KB 76.4KB +270B 14.6KB 14.6KB 0B
core/NumberInput 55.7KB 56.0KB +278B 10.7KB 10.7KB 0B
core/Outline 28.6KB 28.9KB +290B 4.0KB 4.0KB 0B
core/Pagination 87.7KB 117.8KB +30.1KB ⚠️ 15.3KB 15.2KB -131B
core/Popover 49.8KB 50.1KB +238B 12.1KB 12.1KB 0B
core/PowerSearch 155.1KB 185.4KB +30.3KB ⚠️ 18.6KB 18.6KB -67B
core/RadioListItem 52.1KB 82.3KB +30.1KB ⚠️ 9.7KB 9.6KB -114B
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 110.0KB +30.9KB ⚠️ 15.0KB 14.9KB -89B
core/SelectorOption 14.5KB 44.3KB +29.8KB ⚠️ 5.1KB 5.0KB -104B
core/SideNav 58.0KB 58.3KB +272B 10.6KB 10.6KB 0B
core/SideNavCollapseButton 46.6KB 46.9KB +242B 9.5KB 9.5KB 0B
core/SideNavHeading 54.7KB 55.0KB +248B 10.1KB 10.1KB 0B
core/SideNavItem 54.5KB 54.8KB +266B 10.1KB 10.1KB 0B
core/Step 32.4KB 32.7KB +279B 5.3KB 5.3KB 0B
core/Stepper 47.4KB 47.7KB +265B 9.6KB 9.6KB 0B
core/Switch 48.4KB 48.7KB +285B 9.3KB 9.3KB 0B
core/Tab 9.7KB 10.0KB +294B 4.1KB 4.1KB 0B
core/TabMenu 51.6KB 51.9KB +276B 10.0KB 10.0KB 0B
core/Table 84.0KB 114.4KB +30.4KB ⚠️ 15.1KB 15.0KB -110B
core/TableCell 78.8KB 109.2KB +30.4KB ⚠️ 14.8KB 14.7KB -146B
core/TableHeaderCell 78.6KB 108.9KB +30.4KB ⚠️ 14.8KB 14.7KB -133B
core/TableSelectionToolbar 52.4KB 52.6KB +278B 11.2KB 11.2KB 0B
core/TextInput 53.5KB 53.8KB +281B 10.5KB 10.5KB 0B
core/Thumbnail 50.7KB 50.9KB +274B 11.0KB 11.0KB 0B
core/TimeInput 86.8KB 87.1KB +266B 13.8KB 13.8KB 0B
core/Timestamp 27.5KB 27.5KB -1B 9.5KB 9.5KB 0B
core/Toast 59.8KB 60.1KB +258B 9.7KB 9.7KB 0B
core/ToggleButton 44.1KB 44.4KB +243B 9.3KB 9.3KB 0B
core/Token 29.6KB 29.9KB +289B 4.5KB 4.5KB 0B
core/Tokenizer 64.8KB 65.1KB +306B 11.7KB 11.7KB 0B
core/TopNav 51.9KB 52.1KB +277B 10.4KB 10.4KB 0B
core/TopNavHeading 54.2KB 54.4KB +231B 9.9KB 9.9KB 0B
core/TopNavItem 9.0KB 9.3KB +283B 3.8KB 3.8KB 0B
core/TopNavMegaMenu 54.2KB 54.4KB +268B 10.8KB 10.8KB 0B
core/TopNavMegaMenuItem 9.1KB 9.4KB +281B 4.1KB 4.1KB 0B
core/TopNavMenu 53.6KB 53.8KB +258B 10.1KB 10.1KB 0B
core/TreeList 32.5KB 32.8KB +274B 4.7KB 4.7KB 0B
core/Typeahead 61.5KB 61.7KB +268B 11.3KB 11.3KB 0B

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.

⚠️ Touch-only size budget

These components grew past the touch-only budget (2 KB gzip JavaScript or 1 KB gzip CSS per component). If the growth runs only on a coarse pointer, load its JavaScript lazily so the import does not carry it, or justify the cost in the pull request description; CSS stays in the package stylesheet, so justify it.

Component JavaScript CSS
core/BreadcrumbItem +30.3KB ⚠️ -46B
core/CheckboxListItem +30.1KB ⚠️ -115B
core/ContextMenu +30.4KB ⚠️ -88B
core/ContextMenuItem +29.9KB ⚠️ -98B
core/DropdownMenu +29.7KB ⚠️ -83B
core/DropdownMenuCheckboxItem +29.8KB ⚠️ -93B
core/DropdownMenuItem +29.7KB ⚠️ -98B
core/DropdownMenuRadioItem +29.8KB ⚠️ -93B
core/DropdownMenuSubMenu +29.7KB ⚠️ -89B
core/Item +29.6KB ⚠️ -107B
core/ListItem +30.1KB ⚠️ -115B
core/Markdown +30.4KB ⚠️ -125B
core/MoreMenu +29.7KB ⚠️ -83B
core/Pagination +30.1KB ⚠️ -131B
core/PowerSearch +30.3KB ⚠️ -67B
core/RadioListItem +30.1KB ⚠️ -114B
core/Selector +30.9KB ⚠️ -89B
core/SelectorOption +29.8KB ⚠️ -104B
core/Table +30.4KB ⚠️ -110B
core/TableCell +30.4KB ⚠️ -146B
core/TableHeaderCell +30.4KB ⚠️ -133B

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
Package stylesheet Gzip before Gzip after Delta
@astryxdesign/core 34.6KB 34.5KB -104B

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

55 of 504 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's decision: this pull request intentionally changes the current row-actions spec (AST-057 FR5 on iOS, so a flick opens or closes the row instead of firing its outermost action, and FR2/DEC-5 everywhere, so the row moves by compositor translate animations instead of a travel custom property), and it adds requirements no current spec states: Item FR9 to FR13 with DEC-3/DEC-4, the new draft AST-094, theme motion roles with a platform adaptation condition, package-level experimental subpaths, and a new presentation="adaptive" breakpoint. An engineering owner records that decision by commenting /approve-spec 023a18c81dd4346b1e5b713721553242f261915d on this pull request (the author may do so as an engineering owner), and the AST-057 text needs the matching amendment, here or on main. Independently of that decision, please address these:

  • Land the predecessors so this pull request holds only its own commit, and bring that commit (2,499 lines) under 2,000 or explain why it cannot be split; the diff now carries 34,324 authored lines.
  • .changeset/item-grid-row.md ships a role="row" change existing callers must adapt to as a patch [feat]; keep the old rendering for them until a declared minor and a [breaking] changeset (AST-017 FR3, FR31).
  • Make the theme motion-role API and draft AST-094 FR4/DEC-1 ("physics are not themable") agree, and drop the release-note sentences the head contradicts (item-swipe-gesture-system.md's "unchanged", the [chore] notes' "no component uses it yet").
  • Attach a physical iOS and Android check of the claim, a flick, a long drag and a tap after a swipe, which AST-057's platform support requires for FR5/FR6, and name the external system each changed Effect synchronizes (react-component-runtime INV3).

[Automated review]

Comment thread .changeset/item-grid-row.md Outdated
@@ -0,0 +1,7 @@
---
'@astryxdesign/core': patch

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 note tells existing role="row" callers they now find an anchor or button in the label cell and must set its tabIndex through controlProps. A change callers must adapt to is incompatible under AST-017 FR3 and needs a [breaking] Changeset (FR31), which a patch-declared main does not admit; please keep the old rendering for existing callers until a declared minor.

Comment thread .changeset/item-swipe-gesture-system.md Outdated
'@astryxdesign/core': patch
---

[fix] Swipe actions on `Item` and `ListItem` run on the gesture system. A row claims a sideways touch at 8 px, before a browser commits to scrolling it. On iOS its swipe begins at UIKit's 25 px, from 0, so a short wobble no longer moves the row; on Android and any other touchscreen the row still moves from the touch-down. The pan is published as `Item.swipe`. A second finger before the claim leaves the touch to the browser's pinch, and after it is ignored. The click a browser synthesizes after a swipe is cancelled at its source instead of being swallowed by a 400 ms timer. The row's motion and where a release lands are unchanged.

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 row's motion and where a release lands are unchanged" is contradicted on iOS by the 25 px start (useSwipeAction.ts:608-627) and by item-swipe-uikit-motion.md in the same release; please drop the sentence or fold this note into that one.

Comment on lines +57 to +69
if (travel >= commitAt) {
return 'perform';
}
if (behavior === 'commit') {
return 'closed';
}
if (velocity >= swipeActions.releaseVelocity) {
return 'open';
}
if (velocity <= -swipeActions.releaseVelocity) {
return 'closed';
}
return travel >= swipeActions.openFraction * openWidth ? 'open' : 'closed';

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 iOS no release velocity fires an entry, and a reveal row released past the panel's width while moving back closes; current AST-057 FR5 says a fling MUST fire the outermost entry under both models and a release past the panel's width MUST rest open. This stays a spec contradiction until an engineering owner amends FR5.

Comment on lines +73 to +80
- **FR4 — Physics are not themable in touch presentations.** A touch
presentation MUST read its motion from the table on every theme. Themes keep
color, shape, type and spacing; the theme's duration and easing tokens keep
governing pointer presentations. **Proposed; pending owner review:** this
narrows `architecture:theme-tokens` (owners: cixzhang, imdreamrunner) to
pointer presentations, and departs from the draft `design:motion` DR3
(owners: ernestt, cixzhang) wherever UIKit settles with an overshoot or
stretches with a rubber band.

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 touch physics are not themable, but this stack ships defineTheme({motion: {springs, durations, curves}}) and a platform condition so themes retune touch motion (.changeset/touch-motion-theme-roles.md). Please make the record and the code agree before an owner rules on either.

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

A fifth condition axis joins the adaptation vocabulary, which the current theme-authoring contract says an adaptation change preserves ("An adaptation change preserves the fixed condition vocabulary"); this needs an engineering owner's decision together with the motion roles.

Comment on lines +290 to +292
useIsomorphicLayoutEffect(() => {
stateRef.current = state;
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

react-component-runtime INV3 asks every new or changed Effect to name the external system it synchronizes; this one, the options copy at lines 300-302, and ItemSwipeLayer.tsx:192-194 and :218-223 only copy render values into refs or publish the key bridge.

@vjeux
vjeux force-pushed the uikit/c12-swipe-compositor branch from 023a18c to 30d21c1 Compare October 24, 2026 22:07
@vjeux

vjeux commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Where each point stands on the new head:

  • INV3: each of these Effects now names what it synchronizes.
    • The gesture recognizer's callbacks and completions run outside React. They read the committed state, options and entries through those refs.
    • The bridge Effect installs this lazily loaded layer's key handler on Item's root and releases it when the layer leaves.
    • The new timer Effect releases the slide-out's fire timer.
    • Each one rewrites or releases idempotently under StrictMode replay.
  • The 2,499-line commit: the Size line in the description breaks it down: the default path and its tests, the Android cases, and the fire-at-the-edge and disabled-track fixes. The gate stays with the behavior it gates.
  • Release notes: item-swipe-gesture-system.md no longer says the motion and the release are unchanged. item-swipe-uikit-motion.md is now [feat], pending the owner's FR5 decision.
  • Waiting for an engineering owner: the FR5 and FR2/DEC-5 amendments, plus three points that come from other pull requests: item-grid-row.md (feat(Item): a grid-row shape — cells under role="row", the row's own control, swipe actions #7270), and the theme motion roles and the platform condition (feat(core): the internal touch foundation: press tracking and the animator #8076).

@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's decision: this pull request intentionally changes the current row-actions spec (AST-057 FR5 on iOS, so a flick opens or closes the row instead of firing its outermost action, and FR2/DEC-5 everywhere, so the row moves by compositor translate animations instead of a travel custom property), and it adds requirements no current spec states (Item FR9 to FR13 with DEC-3/DEC-4, the new draft AST-094, theme motion roles with a platform adaptation condition, and package-level experimental subpaths). An engineering owner records that decision by commenting /approve-spec 30d21c1c57d300126b234b2fec37d03ab1005c3d on this pull request (the author may do so as an engineering owner), and the AST-057 text needs the matching amendment, here or on main. Independently of that decision, please address these:

  • Under Reduce Motion the iOS swipe should cross-fade (opacity only, 200 ms or less) instead of keeping its springs, as current AST-057 FR5 and design:reduced-motion DR2/DR4 now require (packages/core/src/motion/uikit/swipeActions.ts:81).
  • presentation="adaptive" should use the theme's compact definition (below the effective md point, 768 px by default, or 500 px tall) instead of its own 744 px edge, per current AST-012 FR9 and public-component-api INV17.
  • Land the predecessors so this pull request holds only its own commits, and bring those under 2,000 lines or explain why they cannot be split; the diff now carries 34,530 authored lines.
  • .changeset/item-grid-row.md ships a role="row" change existing callers must adapt to as a patch [feat], which AST-017 FR1, FR3 and FR31 classify as breaking.
  • Make the motion-role theme API and AST-094 FR4/DEC-1 agree, drop the stale "no component uses it yet" release notes, clear a pending fire timer before setting another in useSwipeAction.ts, and attach a physical iOS and Android check of FR5/FR6.

[Automated review]

* animators on tracking and release, and the full swipe still performs,
* Oct 23 2026
*/
reducedMotion: 'keep',

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 'keep', the iOS settle, slide-out and spring-back keep their springs under Reduce Motion (the animator skips its substitution for 'keep'). Current AST-057 FR5 now says the slide out, the spring back and the hold-out follow design:reduced-motion, and its DR2 asks for an opacity-only cross-fade of 200 ms or less when a touch drag's release starts the transition, with DR4 admitting no component that keeps springs. Please cross-fade here under prefers-reduced-motion: reduce, unless an engineering owner amends those records first.


/** Both: presentations such as a sheet in place of a popover. */
export const COMPACT_TOUCH_QUERY =
'(width < 744px) and (pointer: coarse), (height < 500px) and (pointer: coarse)';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Current AST-012 FR9 (and public-component-api INV17) makes compact "width below the effective md point or height below 500", taken from the theme's one definition, and names this web touch presentation resolver as one that must use it and keep no size numbers of its own. With 744 px here, a coarse-pointer screen 744 to 767 px wide opens the popover where FR9 gives the sheet, and a theme's md override is ignored. Please build the query from the theme's compact definition, ANDed with the coarse pointer.

if (delay === 0) {
fireIfStill();
} else if (delay != null) {
fireTimerRef.current = setTimeout(fireIfStill, delay);

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 new timer replaces fireTimerRef.current without clearing a pending one, and every callback nulls the ref before checking its motion (line 557). If a finger catches a sliding-out row and releases it past the commit point again, the older timer drops the newer one's handle, so the unmount cleanup can no longer clear it and onActivate can run for a row that is gone. Clearing any pending timer here, and nulling the ref only when it still holds the callback's own timer, closes that.

@cixzhang

Copy link
Copy Markdown
Contributor

Posted by Cindy's agent on her behalf.

Parts of this PR re-implement behavior that already exists, or is being specified, as a shared part of core. Converging keeps one implementation per behavior:

  • Commit or spring back on release. core/src/Item/useSwipeAction.ts:618 decides on its own whether a release finishes or springs back. A shared release rule is being specified (AST-057 FR5 covers row swipe today); avoid a component-specific threshold model.
  • Spring player. core/src/Item/useSwipeAction.ts:361 plays springs with its own player. A single spring player is being specified; please play springs through the shared animator rather than a local wrapper.

This is about where the behavior lives, not about the PR's intent.

vjeux added 23 commits October 29, 2026 10:09
…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.
# Conflicts:
#	packages/core/src/motion/README.md
… first lift event, its pointerup or its touchend, whichever the gesture host releases on
Takes meta#8360's head, which removes a document's or shadow root's
touch-action rules with its last marked element and names the build
changeset's treeshakeCompensation default, in place of 1e1431f.
…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.
@vjeux
vjeux marked this pull request as draft October 29, 2026 22:30
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 29, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 29, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 29, 2026

@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's decision. This pull request intentionally changes current spec:AST-057 FR5 (a flick opens or closes a row and never fires, and the outermost action fires only once the row's content has left its box, not at activation) and FR2/DEC-5 (the row moves by compositor translate animations instead of the travel custom property). It also leaves open whether AST-057's gesture-tuning non-goal or spec:AST-094 FR4/FR17 governs the row's springs and claim distance. An engineering owner records that decision by amending spec:AST-057 on main, or by adding the amendment to this pull request and commenting /approve-spec followed by the full head SHA; the author may do so as an engineering owner. Whatever the decision, please:

  • Land the stacked predecessors so this pull request carries only its own commits, move the astryxStylex default, press-feedback and menu changes to their own pull requests, and bring the swipe change under 2,000 lines or explain why it cannot be split (32,435 authored lines now, 2,959 of them its own).
  • Merge after #8671 or carry its change, because scripts/touch-support-bundle.test.mjs fails on this revision at "is absent from the root entry".
  • Let the gesture host attach for every pointer, as architecture:react-component-runtime INV13 and spec:AST-094 FR19 now require (GestureHost.ts gates on a coarse primary pointer).
  • Add physical-device recordings, which spec:AST-057 requires for FR5 and FR6.

[Automated review]

if (behavior === 'commit') {
return 'closed';
}
if (velocity >= swipeActions.releaseVelocity) {

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 release at 48 px/s or faster opens the row here and never fires the outermost entry. Current spec:AST-057 FR5 still reads "a drag past the commit point or a fling MUST fire the outermost entry", so this line waits on an engineering owner amending FR5.

if (fireTimerRef.current === timer) {
fireTimerRef.current = null;
}
if (motionRef.current === motion) {

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 fire happens only if no other motion has started since the release. A finger that catches the sliding row, a close, or an unmount (the cleanup at lines 426-434) drops the onActivate call. Current spec:AST-057 FR5 reads "onActivate MUST fire at activation", so this needs the same owner ruling as the release rule.

*
* ONLY WHERE THE PRIMARY POINTER IS COARSE
*
* - Recognizers attach, and the host registers listeners, only while the

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gating every attach on a coarse primary pointer contradicts current architecture:react-component-runtime INV13 ("The gesture host attaches for every pointer, with no touch-only query") and spec:AST-094 FR19/FR43. Please attach for every pointer, keep FR43's exceptions, and drop the fine-pointer warning at line 1355.

// nothing appears or moves when the layer mounts; the gesture simply attaches
// once the chunk is ready, as ProgressBar's and Timestamp's lazy affordances do.
const LazyItemSwipeLayer = lazy(async () => import('./ItemSwipeLayer'));
import ItemSwipeLayer, {type ItemSwipeBridge} from './ItemSwipeLayer';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Importing the swipe layer eagerly puts the gesture host and the animator in every Item import: 13.5 KB to 42.6 KB gzipped, built minified with React and StyleX external. It also fails scripts/touch-support-bundle.test.mjs at "is absent from the root entry" until #8671's test change lands.

// compiled (the TypeScript transform drops it as unused), the module is
// never loaded, and its constants never reach the CSS: a media-query key
// fails the build and a value ships as an undefined custom property.
treeshakeCompensation: 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.

This changes the {stylexOptions} form's default for every @astryxdesign/build consumer. It is unrelated to swipe rows and no current claim backs it, so please land it in its own pull request.

This branch was successfully deployed

1 active deployment
Preview — 7fb1ae93 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