Skip to content

fix(Item): swipe actions on the gesture system - #8096

Draft
vjeux wants to merge 1700 commits into
meta:mainfrom
vjeux:uikit/c12-swipe-gestures
Draft

vjeux wants to merge 1700 commits into
meta:mainfrom
vjeux:uikit/c12-swipe-gestures

Conversation

@vjeux

@vjeux vjeux commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Depends on #8360, #8340 and #8069. Review only this PR's change: vjeux/astryx@item-swipe-gestures-base...uikit/c12-swipe-gestures

Why

On a swipe-action row (Item, ListItem), a finger drifting 10 px sideways slid the row (UIKit waits for 25 pt), a tap right after a swipe could be swallowed by a 400 ms timer, and an open row left its hidden side's buttons in the tab order and the accessibility tree.

What led to it

Part of a series bringing Astryx's touch interactions to parity with native iOS (UIKit). The row hand-rolled its gesture code (an axis lock, a pinch watcher, a touch listener, pointer capture, a click timer), each piece re-implementing Astryx's gesture system (spec:AST-094) differently, none at UIKit's thresholds.

Options and tradeoffs

  1. Patch the hand-rolled code: the smallest diff, but a second gesture implementation keeps drifting.
  2. Use the gesture system's horizontal pan: it already lets a second finger zoom the page, claims the touch before the browser scrolls, and cancels the click at its source. Cost: Item's import grows from 11.6 to 30.0 KB gzip, since the gesture code loads with the row (loading it lazily made the first swipe miss).

The 8 px claim with a 25 px start is an owner decision proposed in #8069.

Why this choice

Option 2 fixes all three defects the way every touch component gets them (spec:AST-094 FR10, FR17, FR21).

How to check it

On a phone, or in Chrome's device toolbar with touch, open the Item story "Swipe Actions":

  1. Drag a row 20 px sideways: it stays still (on main it slides).
  2. Drag past 25 px: it follows; let go past halfway and it opens.
  3. Tap a row right after a swipe: the tap works.
  4. Pinch on a row: the page zooms; the row doesn't swipe.
  5. Swipe vertically: the page scrolls; the row stays shut.
  6. With a row open, press Tab: the hidden side's buttons are skipped.
  7. Drag a row with a mouse: nothing moves.

We ran every step with real touch in Chromium and the main paths on the iOS 26.2 simulator and the Android 15 emulator; each behaved as listed (recordings below). The unit tests (pnpm exec vitest run packages/core/src/Item) and the Chromium touch specs pass.

Evidence

iOS 26.2 Safari, main above: a 20 pt wobble slides main's row, not this one.

Chromium, real touch: still for 24 px, then moving.

Android 15: a sideways swipe opens; a vertical one scrolls.

The story keeps main's 237 elements. 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:38pm 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, 10:57 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.

This pull request is on hold for an engineering owner's decision: it adds the draft spec:AST-094 and new component:Item requirements (FR9–FR13, AR3–AR5, ORD2–ORD3, PR2, DEC-3, DEC-4), and it describes the 8 px / 25 px swipe split as pending owner review. An engineering owner, including the author if they are one, can record approval by commenting /approve-spec <full head SHA> on this pull request, or say which of these deltas must change or land separately. Whatever that decision, these changes are still needed:

  • Land the predecessor pull requests (or retarget the base) so this one carries only its own commit; it currently diffs 26,239 authored lines.
  • A two-finger pinch that lands on two different swipe rows still does not zoom the page and opens both rows, contrary to the item-swipe-pinch-zoom changeset.
  • spec:AST-057 asks for physical touch-device evidence for FR5/FR6; the evidence so far is the iOS simulator and Chromium.
  • The unused resolveRelease says a flick never fires an action, which contradicts spec:AST-057 FR5.

[Automated review]

}
const target = touch.target instanceof Node ? touch.target : event.target;
const {recognizers, consumer} = this.participantsAt(target, 'touch');
if (recognizers.length === 0 && consumer == null) {

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 finger that lands on another swipe row is tracked only for that row's recognizers, so this row's one-finger pan never learns a second finger is down. A pinch across two rows is then claimed by both pans: the page does not zoom and both rows open (Chromium, Swipe Actions story: zoom 1.00, rows moved 146 px and 97 px). Failing a touch-only one-finger pan while another finger is down anywhere (TouchEvent.touches) before it claims would restore the hand-off the changeset promises.

'@astryxdesign/core': patch
---

[fix] A row with `swipeActions` no longer blocks pinch-zoom. A pinch that started on a swipeable `Item` or `ListItem` did nothing, because the row declared `touch-action: pan-y`, and a sideways pinch could also be taken as a swipe. The row now leaves pinch to the browser (`pan-y pinch-zoom`), and a second finger that lands before the swipe has begun, on the row or anywhere else, hands the touch to the browser, so the page zooms and the row stays where it is. One-finger swipes and vertical scrolling 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.

"on the row or anywhere else" does not hold for a second finger on another swipeable row: there the page does not zoom and both rows swipe open.

* it opens and closes it when it closes, from anywhere short of the commit
* point. A slower one goes by where it is, against `openFraction` of the
* open width. So a flick opens the row even from a short drag and closes it
* from anywhere, and a flick never fires an action: only a release past 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.

spec:AST-057 FR5 says a fling MUST fire the outermost entry; "a flick never fires an action" contradicts it. The swipe hook does not call resolveRelease, so drop it (with releaseVelocity and openFraction) or keep it out until FR5 is amended.

@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 1257 -
Complexity Very High Very High (113) -

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 84.8KB +18.4KB ⚠️ 11.0KB 11.0KB 0B
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 72.4KB +18.4KB ⚠️ 10.5KB 10.5KB 0B
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 96.3KB +18.6KB ⚠️ 14.6KB 14.6KB 0B
core/ContextMenuItem 16.6KB 34.8KB +18.2KB ⚠️ 5.2KB 5.2KB 0B
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 90.8KB +18.1KB ⚠️ 14.7KB 14.7KB 0B
core/DropdownMenuCheckboxItem 16.1KB 34.3KB +18.2KB ⚠️ 5.6KB 5.6KB 0B
core/DropdownMenuItem 15.4KB 33.5KB +18.1KB ⚠️ 5.2KB 5.2KB 0B
core/DropdownMenuRadioItem 16.2KB 34.4KB +18.2KB ⚠️ 5.6KB 5.6KB 0B
core/DropdownMenuSubMenu 58.1KB 76.0KB +17.9KB ⚠️ 9.5KB 9.5KB 0B
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 29.3KB +18.0KB ⚠️ 4.7KB 4.7KB 0B
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 71.8KB +18.4KB ⚠️ 10.5KB 10.5KB 0B
core/Markdown 144.5KB 163.3KB +18.8KB ⚠️ 17.4KB 17.4KB 0B
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 90.9KB +18.0KB ⚠️ 14.7KB 14.7KB 0B
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 106.2KB +18.5KB ⚠️ 15.3KB 15.3KB 0B
core/Popover 49.8KB 50.1KB +238B 12.1KB 12.1KB 0B
core/PowerSearch 155.1KB 173.5KB +18.5KB ⚠️ 18.6KB 18.6KB 0B
core/RadioListItem 52.1KB 70.6KB +18.5KB ⚠️ 9.7KB 9.7KB 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 98.2KB +19.1KB ⚠️ 15.0KB 15.0KB 0B
core/SelectorOption 14.5KB 32.6KB +18.1KB ⚠️ 5.1KB 5.1KB 0B
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 102.5KB +18.5KB ⚠️ 15.1KB 15.1KB 0B
core/TableCell 78.8KB 97.3KB +18.5KB ⚠️ 14.8KB 14.8KB 0B
core/TableHeaderCell 78.6KB 97.1KB +18.5KB ⚠️ 14.8KB 14.8KB 0B
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 +18.4KB ⚠️ 0B
core/CheckboxListItem +18.4KB ⚠️ 0B
core/ContextMenu +18.6KB ⚠️ 0B
core/ContextMenuItem +18.2KB ⚠️ 0B
core/DropdownMenu +18.1KB ⚠️ 0B
core/DropdownMenuCheckboxItem +18.2KB ⚠️ 0B
core/DropdownMenuItem +18.1KB ⚠️ 0B
core/DropdownMenuRadioItem +18.2KB ⚠️ 0B
core/DropdownMenuSubMenu +17.9KB ⚠️ 0B
core/Item +18.0KB ⚠️ 0B
core/ListItem +18.4KB ⚠️ 0B
core/Markdown +18.8KB ⚠️ 0B
core/MoreMenu +18.0KB ⚠️ 0B
core/Pagination +18.5KB ⚠️ 0B
core/PowerSearch +18.5KB ⚠️ 0B
core/RadioListItem +18.5KB ⚠️ 0B
core/Selector +19.1KB ⚠️ 0B
core/SelectorOption +18.1KB ⚠️ 0B
core/Table +18.5KB ⚠️ 0B
core/TableCell +18.5KB ⚠️ 0B
core/TableHeaderCell +18.5KB ⚠️ 0B

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.6KB 0B

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.

This pull request is on hold for an engineering owner's decision: it adds the draft spec:AST-094 and new component:Item requirements (FR9–FR13, AR3–AR5, ORD2–ORD3, PR2, DEC-3, DEC-4), and it calls the 8 px / 25 px swipe split pending owner review. An engineering owner, including the author if they are one, can record approval by commenting /approve-spec <full head SHA> on this pull request, or say which of these deltas must change or land separately. Whatever that decision, these changes are still needed:

  • Land the predecessor pull requests (or retarget the base) so this one carries only its own commit; it currently diffs 32,040 authored lines.
  • A sideways two-finger pinch whose second finger lands off the first finger's row (on another swipe row, or off the list) no longer zooms the page and swipes the row instead, where the base handed it to the browser.
  • The new platform adaptation condition is outside the closed when vocabulary of spec:AST-012 FR2.
  • spec:AST-057 asks for physical touch-device evidence for FR5/FR6, and the unused resolveRelease says a flick never fires an action, which contradicts FR5.

[Automated review]

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

spec:AST-012 FR2 keeps the when vocabulary closed to width, pointer, contrast and motion and says new environment fields need an explicit addition to it. platform needs that amendment first, or should leave this stack.

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 pan is published as Item.swipe" promises a handle no app can reach: name is a debugging label, the recognizer never leaves the hook, and requireToFail takes an instance.

@vjeux
vjeux force-pushed the uikit/c12-swipe-gestures branch from 291b98e to 11e7d0c 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:

@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 pull request is on hold for an engineering owner's decision: it adds the draft spec:AST-094 and new component:Item requirements (FR9–FR13, AR3–AR5, ORD2–ORD3, PR2, DEC-3, DEC-4), and it calls the 8 px / 25 px swipe split pending owner review. An engineering owner, including the author if they are one, can record approval by commenting /approve-spec <full head SHA> on this pull request, or say which of these deltas must change or land separately. Whatever that decision, these changes are still needed:

  • Land the predecessor pull requests (or retarget the base) so this one carries only its own commit; it currently diffs 32,040 authored lines.
  • The compact-touch query uses 744 px, while spec:AST-012 FR9 on main defines compact as below the md point (768 px by default) or under 500 px tall, and the platform adaptation condition is outside FR2's closed vocabulary.
  • spec:AST-057 asks for physical touch-device evidence for FR5/FR6, and the unused resolveRelease says a flick never fires an action, which contradicts FR5.
  • The page does zoom on an off-row pinch, but outside iOS the rows under the fingers slide up to 15 px first; failing the one-finger pan whenever another finger is down would keep them still.

[Automated review]

export const TOUCH_QUERY = '(pointer: coarse)';

/** The viewport is compact: layout behaviours. */
export const COMPACT_QUERY = '(width < 744px), (height < 500px)';

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-012 FR9 (approved on main after this branch point) defines compact as a viewport width below the effective md point (768 px by default) or a height below 500, and says every resolver, including this one, uses that one definition with no size numbers of its own. With 744 px a coarse-pointer screen 744–767 px wide now gets the popover instead of the sheet (DropdownMenu's adaptive story at 760 × 1000: sheet on the base, popover here).

}
const target = touch.target instanceof Node ? touch.target : event.target;
const {recognizers, consumer} = this.participantsAt(target, 'touch');
if (recognizers.length === 0 && consumer == null) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Rechecked with real Chromium touch on this head: the page does zoom when the second finger lands on another row or off the list (scale 3.14–5), so the earlier note that the zoom is lost does not hold. Outside iOS the row's one-finger pan still never learns of that finger, claims at 8 px, and slides the row 14–15 px before the browser's pinch takes the touch; base rows stay at 0 px. Failing a possible touch-only one-finger pan while TouchEvent.touches holds another finger would keep them still.

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

  • Release velocity. core/src/Item/useSwipeAction.ts:74 estimates the finger's speed at lift with a local estimator. A shared velocity module is being specified so every gesture reads one velocity; please don't add another estimator here.

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

@vjeux

vjeux commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Agreed: one implementation.

@vjeux
vjeux force-pushed the uikit/c12-swipe-gestures branch from 11e7d0c to d738188 Compare October 25, 2026 00:43
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 25, 2026
…d on the restacked head (no emulation; a second finger now gives the swipe up, meta#8336), Android 15 emulator takes (Chrome 124, 540x1200)
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Oct 25, 2026
vjeux added 29 commits October 28, 2026 17:39
…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.
Folds this pull request onto the canonical gesture foundation, meta#8360's
head, which carries meta#8076's animator, and onto main, in place of the old
meta#8076 copies it carried. No conflicts: this pull request's own commits
touch only the animator's presentation start and its tests.
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.
# Conflicts:
#	packages/core/src/motion/README.md
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.

@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 pull request is on hold for engineering-owner spec decisions: the row's pan begins at 8 px while spec:AST-094 FR17 starts a pan at 10 pt, which needs a dated FR2 owner decision, and the unused resolveRelease and its changeset state that a flick never fires an action, which would need spec:AST-057 FR5 updated. An engineering owner records those decisions by commenting /approve-spec <full head SHA> on this pull request and updating the existing spec on main, and the author may do so if they are an engineering owner. Whatever they decide, these changes are still needed:

  • Under a fine primary pointer, a mounted swipe row keeps the gesture host's window listeners subscribed while idle, while spec:AST-094 FR24 allows document listeners only during a press.
  • The gesture host attaches only where the primary pointer is coarse, which spec:AST-094 FR19, FR43 and DEC-21 reject, and Item.test.tsx asserts that gate.
  • Narrow the compare range to this pull request's own swipe change: with the unmerged stack beneath it, the range carries 29,814 authored lines for a 1,868-line change.
  • Add the physical-device check spec:AST-057 requires for FR5 and FR6 (a real iPhone in Safari and a real Android phone in Chrome).

[Automated review]

* (the last cancelable `touchmove` at 10 px; cancelling every `touchmove`
* from 8 px keeps the page still for the whole gesture), Oct 23 2026
*/
claim: 8,

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 FR17 says "A pan begins at 10 pt of travel on either axis", and FR2 lets an owner decision depart from a measurement only when it names its date and the measurement it departs from. The description calls this value "an owner decision proposed in #8069"; until an engineering owner records it in AST-094, this value is held.

* it opens and closes it when it closes, from anywhere short of the commit
* point. A slower one goes by where it is, against `openFraction` of the
* open width. So a flick opens the row even from a short drag and closes it
* from anywhere, and a flick never fires an action: only a release past 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.

"A flick never fires an action" contradicts current spec:AST-057 FR5 ("a drag past the commit point or a fling MUST fire the outermost entry"), which the hook still implements (useSwipeAction.ts L509–511). Until an engineering owner approves the amendment proposed in #8097, resolveRelease, the table's note and the uikit-swipe-actions-values changeset wait on it or leave this range.

// `spec:AST-057` reads each event's pointer: a finger swipes the row on
// every device and a mouse never does, so the host's fine-pointer gate
// (`spec:AST-094` FR19) does not apply to it.
{perEventPointer: 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.

Under a fine primary pointer this opt-out makes the host subscribe its 13 window listeners (pointermove, a capturing scroll, non-passive touchend and contextmenu, and the rest) for as long as a swipe row is mounted (GestureHost.ts isActive(), shouldListen(), install()). Current spec:AST-094 FR24 says "Under a fine pointer a component that uses a gesture listens only on its own element and adds document listeners only during a press, removing them at the release (FR43)", and FR19 on main has no fine-pointer gate left to opt out of. Serving this recognizer the way the host serves an action group, one passive pointerdown on the element and page listeners only while the press is held, would meet FR24.

Comment on lines +1085 to +1094
// Not opted out of the gate: inactive where the primary pointer is fine.
expect(taps).not.toContain('ended');
// The row swipes under a finger beside it.
dragLeading(row, 45);
await settled();
expect(xOf(row)).toBe(72);
expect(warn).toHaveBeenCalledTimes(1);
expect(warn).toHaveBeenCalledWith(
expect.stringContaining('attached where the primary pointer is fine'),
);

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 pins a fine-pointer gate that main has replaced: spec:AST-094 FR19 now says "Recognizers attach for every pointer, with FR43's exceptions", and DEC-21 records "Rejected: keeping gestures and press tracking touch-only". Once the host conforms, this case should expect the neighbouring tap to recognize under a fine pointer, with no warning.

* ONLY WHERE THE PRIMARY POINTER IS COARSE
*
* - Recognizers attach, and the host registers listeners, only while the
* primary pointer is coarse (`spec:AST-094` FR19, FR24; coarsePointer.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.

This is the direction current spec:AST-094 DEC-21 rejects ("Rejected: keeping gestures and press tracking touch-only"): FR19 says "Recognizers attach for every pointer, with FR43's exceptions", and architecture:react-component-runtime INV13 "The gesture host attaches for every pointer, with no touch-only query".

return tap.numberOfTapsRequired === 1 && tap.numberOfTouchesRequired === 1;
}

export class PressTracker implements TouchConsumer {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

architecture:react-component-runtime INV13 keeps classes to the recognizer family ("its base, the arena, and the host") and fails "a class outside the recognizer family"; the press tracker would be a create… factory. This belongs to the stack beneath this pull request and leaves the range when it is narrowed.

This branch was successfully deployed

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