Skip to content

fix(core): one input stream on the window's capture phase for the press feedback and the gesture host - #8356

Closed
vjeux wants to merge 1478 commits into
meta:mainfrom
vjeux:uikit/f2-input-stream
Closed

vjeux wants to merge 1478 commits into
meta:mainfrom
vjeux:uikit/f2-input-stream

Conversation

@vjeux

@vjeux vjeux commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Depends on #8293. Review only this pull request's change: vjeux/astryx@c1186e4...886749b

Why

An app's own capture-phase listener can silently switch off Astryx's touch handling. If the app shell calls stopPropagation on the window, or stopImmediatePropagation on the document, from a listener registered before the first recognizer, the gesture host never sees the touch: a sheet can't be dragged and a row swipe never fires, with no error anywhere.

What led to it

This came up in the UIKit-parity work on Astryx's touch components. In UIKit, gesture recognizers see a touch before any view does. Astryx's host listened at the document's capture phase, which runs after the window's, and each touch subsystem (the host, the press feedback, the page hold, the finger-scroll watch) registered its own page-wide listeners.

Options and tradeoffs

  • Document the limitation and ask apps not to stop propagation early: the failure stays silent, and an app may not know a library depends on it.
  • Move each subsystem's listeners to the window: earlier, but still several listeners per event type, in an order nobody controls.
  • One shared input stream: one native listener per event type on the window's capture phase, handing each event to its subscribers in order.

Why this choice

The window's capture phase is the earliest point the web offers, so recognizers see touches first, as in UIKit (spec:AST-094 FR1). One listener per type keeps the page's listener count flat however many components mount (FR24). The listener is passive unless a subscriber needs to cancel, and a subscriber that throws is reported without stopping the others.

How to check it

  1. Add to a page, before Astryx loads, a window capture listener that calls event.stopPropagation() on touchstart.
  2. On a phone, drag a bottom sheet. Expected: it follows the finger.
  3. Swipe a list row that has swipe actions. Expected: the actions reveal.
  4. Mount several touch components and inspect the window's listeners. Expected: one per event type.

Evidence

  • Two gesture-host cases, an app's window-capture stopPropagation and its document-capture stopImmediatePropagation registered first, fail before the change and pass after.
  • The stream's unit cases: one native listener per type, removed with the last subscriber; subscribers in order and isolated from each other's errors; passive until a subscriber cancels.
  • The gesture and press suites and the real-engine gesture proofs are unchanged.

@vercel

vercel Bot commented Oct 25, 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 27, 2026 2:44pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Oct 29, 2026, 2:49 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 waits on an owner decision: spec:AST-094, which it adds as a draft, needs an engineering owner to approve, amend or reject FR1–FR23 with DEC-1 and DEC-2, including a requirement for the input stream itself, which no claim states yet, and whether FR4 (touch motion read from the UIKit table on every theme) or the new theme motion roles stand, and an engineering owner records that by commenting /approve-spec <full head SHA> on this pull request (the author may, as an engineering owner). Independently of that decision, please reduce the compare to this fix's own commit by landing or retargeting #8293 and its predecessors, since it currently carries 35,734 authored lines, and address the points below.

  • Take the press feedback's selection lock only for touch, because it now changes stable pressables and pen input under an [experimental] release note.
  • Remove the platform adaptation axis from the theme template, since defineTheme refuses it.
  • Make presentation="adaptive" honor a theme's overridden md, or stop promising that in the release note.
  • Align AST-094 FR8's 0.5 s cross-fade with the current reduced-motion record's 200 ms, cite only claims that exist (the body's FR1, spec:AST-100, AST-094 OQ4 and AST-090), and describe the input stream's fix as the two cases it actually covers.

[Automated review]

Comment on lines +305 to +307
// A held finger never starts text selection on the surface (UIKit's
// controls and cells never do), on any coarse pointer.
unlock: lockSelection([element], 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.

This lock runs for every pointer except a mouse, so a pen, a fine pointer, also loses text selection on every stable pressable, and the release note calls it [experimental]. Current spec:AST-017 FR27 says an omitted opt-in must leave stable behavior unchanged, and FR59 allows a fine-pointer change from touch work only with a named reason and before-and-after evidence. Taking the lock only for event.pointerType === 'touch' matches the comment above.

Comment thread packages/cli/assets/theme.template.ts Outdated
Comment on lines +361 to +362
* are primary-pointer precision, contrast preference, motion preference, and
* platform (`ios` for the browsers of iPhone and iPad, `other` for the rest).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Adaptations refuse a platform condition (expandMotionRoles.test.ts pins that defineTheme throws), and spec:AST-012 FR2 closes when to width, height, pointer, contrast and motion. A theme author who follows this line gets an error; please drop the platform clause.

Comment on lines +71 to +72
export const COMPACT_TOUCH_QUERY =
DEFAULT_COMPACT_DEFINITION.coarsePointerQuery;

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 built once from DEFAULT_COMPACT_DEFINITION, so a theme that overrides md still switches the adaptive menus at 768 px, while spec:AST-012 FR9 uses the effective md point and .changeset/touch-presentation.md promises the theme's md. Either resolve the query from the active theme's compactDefinition(widthBreakpoints) or state the fixed 768 px in the release note.

Comment on lines +107 to +108
place, and any other move fades through. A navigation push or pop
cross-fades over 0.5 s on the ease-in-out curve; a sheet, a full-screen

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 0.5 s cross-fade under Reduce Motion contradicts the current reduced-motion design record's DR2 (opacity only, 200 ms or less), which the animator in this pull request already follows (timing.reducedMotionCrossFadeMs, 200 ms). Please align FR8 with it or list the amendment under Current-state impact for its owner.

'@astryxdesign/core': patch
---

[fix] The touch press feedback and the gesture recognizers now listen on the window's capture phase through one shared input stream: one passive listener per event type for both. An app's own capture-phase `stopPropagation` at the document no longer starves them, and a page of pressables registers no listener that can hold a scroll.

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 capture-phase stopPropagation at the document never stopped another listener on the document, as the description notes; the cases this fixes are a window-capture stopPropagation and a document-capture stopImmediatePropagation. The press feedback's pointer listeners were already on the window, and touchend, click and contextmenu stay non-passive, so "one passive listener per event type" overstates it too.

Comment thread scripts/sync-exports.js Outdated
@@ -177,6 +190,13 @@ const STATIC_EXPORTS = {
types: './dist/utils/interactionOverlay.stylex.d.ts',
default: './dist/utils/interactionOverlay.stylex.js',
},
// Proposed; pending owner review (spec:AST-094 OQ4): the Reduce 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.

spec:AST-094 has OQ1 and OQ2 only, so this OQ4 citation points nowhere; and as a non-experimental subpath, ./motion/reducedMotion.stylex would carry the stable compatibility promise once released.

@@ -28,8 +28,13 @@
* (`@media (pointer: coarse)`) and this writes `data-astryx-press="on"` when the
* press is believed and `data-astryx-press="fading"` for the release's exit.
*
* While a finger or a pen is down on a surface, its text selection and the
* touch callout are off (gestures/selectionLock.ts, shared with the gesture

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

selectionLock.ts moved to utils/ in this commit; this line and the SYNC list at line 36 still point to gestures/selectionLock.ts.

@github-actions

github-actions Bot commented Oct 25, 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.5KB +615B 12.4KB 12.4KB 0B
core/AppShell 57.9KB 58.4KB +550B 11.6KB 11.6KB 0B
core/AvatarGroupOverflow 39.9KB 40.5KB +627B 6.4KB 6.4KB 0B
core/Banner 47.8KB 48.4KB +594B 9.9KB 9.9KB 0B
core/BaseTypeahead 54.3KB 54.9KB +552B 9.9KB 9.9KB 0B
core/BreadcrumbItem 66.4KB 66.9KB +590B 11.0KB 11.0KB 0B
core/Button 43.3KB 43.9KB +604B 9.2KB 9.2KB 0B
core/Calendar 54.9KB 55.5KB +601B 10.0KB 10.0KB 0B
core/Carousel 50.2KB 50.8KB +634B 10.2KB 10.2KB 0B
core/ChatComposer 60.6KB 61.2KB +602B 10.8KB 10.8KB 0B
core/ChatComposerInput 55.7KB 56.3KB +577B 10.1KB 10.1KB 0B
core/ChatComposerTokenElement 55.7KB 56.3KB +575B 10.1KB 10.1KB 0B
core/ChatDictationButton 46.5KB 47.1KB +585B 9.5KB 9.5KB 0B
core/ChatLayout 48.8KB 49.4KB +598B 9.9KB 9.9KB 0B
core/ChatLayoutScrollButton 46.4KB 47.0KB +577B 9.6KB 9.6KB 0B
core/ChatSendButton 45.8KB 46.4KB +575B 9.2KB 9.2KB 0B
core/CheckboxInput 49.9KB 50.5KB +575B 9.3KB 9.3KB 0B
core/CheckboxListItem 54.0KB 54.6KB +564B 10.5KB 10.5KB 0B
core/ClickableCard 12.8KB 13.4KB +626B 6.9KB 6.9KB 0B
core/CodeBlock 60.5KB 61.1KB +591B 10.7KB 10.7KB 0B
core/Collapsible 11.7KB 12.3KB +608B 4.2KB 4.2KB 0B
core/CommandPalette 50.9KB 51.5KB +577B 11.8KB 11.8KB 0B
core/CommandPaletteItem 8.4KB 9.0KB +596B 3.5KB 3.5KB 0B
core/ComplexSelector 55.8KB 56.4KB +628B 10.6KB 10.6KB 0B
core/ContextMenu 77.7KB 78.3KB +567B 14.6KB 14.6KB 0B
core/ContextMenuItem 16.6KB 17.2KB +640B 5.2KB 5.2KB 0B
core/DateInput 99.9KB 100.4KB +565B 14.8KB 14.8KB 0B
core/DateRangeInput 69.4KB 70.0KB +625B 11.2KB 11.2KB 0B
core/DateTimeInput 110.1KB 110.6KB +551B 15.2KB 15.2KB 0B
core/DialogHeader 48.8KB 49.4KB +585B 9.8KB 9.8KB 0B
core/DrawerHeader 48.9KB 49.5KB +550B 11.2KB 11.2KB 0B
core/DropdownMenu 72.7KB 73.2KB +567B 14.7KB 14.7KB 0B
core/DropdownMenuCheckboxItem 16.1KB 16.7KB +617B 5.6KB 5.6KB 0B
core/DropdownMenuItem 15.4KB 16.0KB +611B 5.2KB 5.2KB 0B
core/DropdownMenuRadioItem 16.2KB 16.8KB +607B 5.6KB 5.6KB 0B
core/DropdownMenuSubMenu 58.1KB 58.6KB +571B 9.5KB 9.5KB 0B
core/FileInput 54.1KB 54.6KB +557B 10.3KB 10.3KB 0B
core/IconButton 43.3KB 43.9KB +603B 9.2KB 9.2KB 0B
core/Item 11.4KB 11.9KB +606B 4.7KB 4.7KB 0B
core/LayerProvider 63.3KB 63.9KB +606B 10.1KB 10.1KB 0B
core/Lightbox 51.2KB 51.7KB +559B 9.8KB 9.8KB 0B
core/Link 43.5KB 44.1KB +599B 7.6KB 7.6KB 0B
core/ListItem 53.5KB 54.0KB +571B 10.5KB 10.5KB 0B
core/Markdown 144.5KB 145.0KB +536B 17.4KB 17.4KB 0B
core/MobileNav 51.0KB 51.6KB +557B 10.1KB 10.1KB 0B
core/MobileNavToggle 46.2KB 46.8KB +572B 9.4KB 9.4KB 0B
core/MoreMenu 72.9KB 73.5KB +590B 14.7KB 14.7KB 0B
core/MultiSelector 76.2KB 76.7KB +566B 14.6KB 14.6KB 0B
core/NumberInput 55.7KB 56.2KB +566B 10.7KB 10.7KB 0B
core/Outline 28.6KB 29.2KB +592B 4.0KB 4.0KB 0B
core/Pagination 87.7KB 88.3KB +558B 15.3KB 15.3KB 0B
core/Popover 49.8KB 50.4KB +525B 12.1KB 12.1KB 0B
core/PowerSearch 155.1KB 155.6KB +551B 18.6KB 18.6KB 0B
core/RadioListItem 52.1KB 52.7KB +598B 9.7KB 9.7KB 0B
core/SegmentedControlItem 8.6KB 9.2KB +597B 3.9KB 3.9KB 0B
core/SelectableCard 12.8KB 13.4KB +623B 7.1KB 7.1KB 0B
core/Selector 79.1KB 79.7KB +598B 15.0KB 15.0KB 0B
core/SelectorOption 14.5KB 15.1KB +601B 5.1KB 5.1KB 0B
core/SideNav 58.0KB 58.6KB +587B 10.6KB 10.6KB 0B
core/SideNavCollapseButton 46.6KB 47.2KB +572B 9.5KB 9.5KB 0B
core/SideNavHeading 54.7KB 55.3KB +569B 10.1KB 10.1KB 0B
core/SideNavItem 54.5KB 55.0KB +549B 10.1KB 10.1KB 0B
core/Step 32.4KB 33.0KB +584B 5.3KB 5.3KB 0B
core/Stepper 47.4KB 47.9KB +562B 9.6KB 9.6KB 0B
core/Switch 48.4KB 49.0KB +583B 9.3KB 9.3KB 0B
core/Tab 9.7KB 10.3KB +608B 4.1KB 4.1KB 0B
core/TabMenu 51.6KB 52.2KB +579B 10.0KB 10.0KB 0B
core/Table 84.0KB 84.5KB +532B 15.1KB 15.1KB 0B
core/TableCell 78.8KB 79.3KB +555B 14.8KB 14.8KB 0B
core/TableHeaderCell 78.6KB 79.1KB +559B 14.8KB 14.8KB 0B
core/TableSelectionToolbar 52.4KB 52.9KB +596B 11.2KB 11.2KB 0B
core/TextInput 53.5KB 54.1KB +586B 10.5KB 10.5KB 0B
core/Thumbnail 50.7KB 51.3KB +602B 11.0KB 11.0KB 0B
core/TimeInput 86.8KB 87.4KB +565B 13.8KB 13.8KB 0B
core/Timestamp 27.5KB 27.5KB -1B 9.5KB 9.5KB 0B
core/Toast 59.8KB 60.4KB +581B 9.7KB 9.7KB 0B
core/ToggleButton 44.1KB 44.7KB +565B 9.3KB 9.3KB 0B
core/Token 29.6KB 30.2KB +598B 4.5KB 4.5KB 0B
core/Tokenizer 64.8KB 65.4KB +621B 11.7KB 11.7KB 0B
core/TopNav 51.9KB 52.4KB +553B 10.4KB 10.4KB 0B
core/TopNavHeading 54.2KB 54.7KB +563B 9.9KB 9.9KB 0B
core/TopNavItem 9.0KB 9.6KB +605B 3.8KB 3.8KB 0B
core/TopNavMegaMenu 54.2KB 54.8KB +599B 10.8KB 10.8KB 0B
core/TopNavMegaMenuItem 9.1KB 9.7KB +603B 4.1KB 4.1KB 0B
core/TopNavMenu 53.6KB 54.2KB +583B 10.1KB 10.1KB 0B
core/TreeList 32.5KB 33.1KB +579B 4.7KB 4.7KB 0B
core/Typeahead 61.5KB 62.0KB +581B 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.

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

@vjeux
vjeux force-pushed the uikit/f2-input-stream branch from ae623bd to 5d972b9 Compare October 25, 2026 06:52
@vjeux
vjeux force-pushed the uikit/f2-input-stream branch from 218bbb3 to ae64881 Compare October 25, 2026 09:12
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 25, 2026
Both edit utils/pressFeedback.ts. meta#8118's controller (two slots, listeners
only while a press is live, the coarse-gated clocks) is kept, and meta#8356's
changes to the old controller are carried onto it: its listeners subscribe
through the shared input stream (the keyboard stays on the window's bubble
phase), a finger's press takes the selection lock where
locksSelectionFor() says so, and isPressFeedbackInstalled is exported. The
listener test reads the stream's window listeners; meta#8356's link-callout and
pen tests are kept.

@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 waits on an owner decision: no spec on main covers delivering touch input through one capture-phase listener per event type on the window, and the cited spec:AST-094 FR1 exists only in the open #8394, where it covers measured motion values, so an engineering owner needs to provide or identify the governing claim and record that decision by commenting /approve-spec <full head SHA> on this pull request (the author may do so as an engineering owner). Independently of that decision, please reduce the compare to this fix's own commits by landing or retargeting #8293 and its predecessors, since it currently carries 35,419 authored lines, and address the points below.

  • Split the theme motion roles into #8257, since their --motion-* names do not originate in tokens.stylex.ts (architecture:theme-tokens INV1) and springs.menuReducedMotion is a role that design:reduced-motion forbids any motion from playing.
  • Correct .changeset/input-stream.md to name the cases actually fixed (a window-capture stopPropagation and a document-capture stopImmediatePropagation) and to say that touchend, click and contextmenu stay non-passive.
  • Mark .changeset/reduced-motion-record.md as an internal [chore], and update the gestures/selectionLock.ts references in pressFeedback.ts.

[Automated review]

'@astryxdesign/core': patch
---

[fix] The touch press feedback and the gesture recognizers now listen on the window's capture phase through one shared input stream: one passive listener per event type for both. An app's own capture-phase `stopPropagation` at the document no longer starves them, and a page of pressables registers no listener that can hold a scroll.

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 capture-phase stopPropagation at the document never stopped another listener on the document, as the description notes. The cases this fixes are a window-capture stopPropagation and a document-capture stopImmediatePropagation, each registered first. The press feedback's pointer listeners were already on the window, and touchend, click and contextmenu (plus touchmove during a page hold) are non-passive, so "one passive listener per event type" overstates it too.

}
const variable = motionRoleVariable(id);
try {
tokens[variable] = formatMotionRoleValue(kind, value);

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 writes a --motion-* name built from a motion-table path into the theme's tokens, while the role's default lives in the motion table. architecture:theme-tokens INV1 says a core token name and its default originate in tokens.stylex.ts and that projections do not introduce names. Declaring each role there, or an owner amending INV1, would settle this; the roles have their own pull request in #8257.

* iPhone 17 Pro, `_animateUsingSpringWithDampingRatio:response:tracking:`
* hooked with Reduce Motion on (1.0, 0.4), Oct 23 2026
*/
menuReducedMotion: {response: 0.4, dampingRatio: 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.

Registering this entry makes springs.menuReducedMotion a theme role (roleKinds.generated.ts:30, astryx docs motion). But design:reduced-motion DR1 and DR4 forbid any spring under reduced motion, and nothing reads the role. Keeping it out of the registered roles avoids publishing a theme knob that can never take effect.

Comment thread .changeset/reduced-motion-record.md Outdated
'@astryxdesign/core': patch
---

[fix] The experimental touch animator follows design:reduced-motion. Under Reduce Motion every `animate` and `play` (travel or opacity, on a spring or any curve) becomes an opacity-only cross-fade of 200 ms on a coarse primary pointer, or for a call marked `touchRelease`, and completes at once on any other pointer; nothing moves, scales or springs, and travel lands with a plain style write while the element is transparent, never as an animated transform. `timing.reducedMotionCrossFadeMs` is now 200 ms and is no longer a theme role. The `reducedMotion` and `crossfade` call options are removed; `crossfadeAs` stays. `animator.reducedMotion()` reports the mode for feedback with no fade of its own, `reducedMotionFade()` gives the same fade to code beside the animator, and `reducedMotion.stylex.ts` holds its constants for StyleX transitions.

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 animator has no export path at this head, so a [fix] note about "the experimental touch animator" and its removed call options describes an API that consumers never had. [chore] Internal:, as the other motion changesets use, would fit.

@@ -28,8 +28,13 @@
* (`@media (pointer: coarse)`) and this writes `data-astryx-press="on"` when the
* press is believed and `data-astryx-press="fading"` for the release's exit.
*
* While a finger or a pen is down on a surface, its text selection and the
* touch callout are off (gestures/selectionLock.ts, shared with the gesture

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

selectionLock.ts moved to utils/ in this pull request, but this line and the SYNC list at line 36 still point to gestures/selectionLock.ts.

@@ -433,6 +464,14 @@ function removeListeners(): void {
* are reset with them, so a later install never inherits a gesture that
* never happened.
*/
/**

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

isPressFeedbackInstalled now sits between installPressFeedback's JSDoc (lines 454-466) and that function, so installPressFeedback loses its documentation. Moving this block above that JSDoc keeps both.

vjeux added 6 commits October 27, 2026 00:56
…xposes no ontouchstart is taken once

Chromium fixes ontouchstart when the page is created, so turning touch
emulation on later sends Touch Events without it: the host reads Pointer
Events for the finger and must not read its Touch Events too. A one-finger
long press fails here, the finger tracked twice.
…from their pointer events

install() reads a finger from its pointer events when the window has no
ontouchstart, but the four touch handlers still took the Touch Events a
browser sends anyway (Chromium after touch emulation turns on), tracking
the finger twice, so a one-finger long press never recognized. Each touch
handler now returns while usesTouchEvents is false, after noting the
fingers down, as install()'s comment promised.

@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 Core should hear page-wide input on the window's capture phase, so that an app's earlier capture-phase stop cannot hide a touch from the gesture recognizers: no current spec record states that, and the cited spec:AST-094 FR1 text is not in the record. An engineering owner records that decision by providing or identifying the governing claim and commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner. Independently of that decision, please address the points below.

  • Land or retarget #8293 and its predecessors so the compare holds only this fix: it currently carries 27,427 authored lines for a 1,532-line change.
  • Scope the description, release note and README to what is restored: a pan that must claim its touch (a sheet pull, or a one-way swipe over a scrollable page) is still cancelled under both stops, because its blocking touchmove listener sits on the element below the app's stop.
  • Correct .changeset/input-stream.md, which calls every listener passive and names a document stopPropagation case that never failed, along with the matching comments and the README's listener list.
  • Keep the shared listener in place when a type switches between passive and non-passive, or state that limit, since re-adding it lets app listeners registered after Core run before it.

[Automated review]

'@astryxdesign/core': patch
---

[fix] The touch press feedback and the gesture recognizers now listen on the window's capture phase through one shared input stream: one passive listener per event type for both. An app's own capture-phase `stopPropagation` at the document no longer starves them, and a page of pressables registers no listener that can hold a scroll.

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 is the whole declaration (spec:AST-017 FR7), but the host's touchend, contextmenu and click subscriptions cancel while a claimer is attached (GestureHost.ts:1350, :1359, :1362) and touchmove turns non-passive while a page hold listens (pageHold.ts:192), so not every listener is passive. A document-capture stopPropagation also never stopped another listener on the document (GestureHost.test.ts:1884-1886); the cases fixed are a window-capture stopPropagation and a document-capture stopImmediatePropagation registered before Core.

Comment on lines +121 to +128
view.removeEventListener(type, native.listener, {capture: true});
channel.native = null;
}
if (wanted == null) {
return;
}
const listener: InputListener = event => dispatch(channel, event);
view.addEventListener(type, listener, {capture: true, passive: !wanted});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Removing and re-adding the native listener on a passivity switch appends it after every window-capture listener an app registered since Core's first subscription, so once a page hold starts listening, or the host's claimers change, an app's later stopImmediatePropagation hides those events from every Core subscriber. Keeping each type's listener in place across the switch (a type whose non-passive listener holds no scroll, such as touchend, click or contextmenu, can stay non-passive), or stating the limit in the header, would close this.

Comment on lines +886 to +897
// The blocking listener sits on the element itself (FR19: a scroll that
// starts elsewhere never waits on it), but every element shares the
// host's one handler, which routes through the arena.
if (needsListener && !registration.hasTouchMoveListener) {
element.addEventListener('touchmove', this.onBlockingTouchMove, {
passive: false,
});
registration.hasTouchMoveListener = true;
} else if (!needsListener && registration.hasTouchMoveListener) {
element.removeEventListener('touchmove', this.onBlockingTouchMove);
registration.hasTouchMoveListener = false;
}

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 an app's window-capture stopPropagation or document-capture stopImmediatePropagation, this element listener never runs, so a pan that shares an axis with native scrolling (a sheet pull, a one-way swipe over a scrollable page) still cannot claim its touch and is cancelled when the browser takes it. The description, release note and README could say that recognizers now hear these touches while a claim still needs the event to reach the element.

Comment on lines +397 to +400
unless a subscriber cancels it: the host cancels `touchend`, `click` and
`contextmenu` there, never a `touchstart` or a `touchmove` (a blocking
`touchmove` sits on a claiming element, or on the window only while a page
hold is held), so a page of pressables blocks no scroll.

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 blocking touchmove also sits on the document while a claiming element moves (GestureHost.ts:1132, and "Touches on moving elements" below) and on the touch target (GestureHost.ts:2095-2099), so this list is incomplete.

@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 Core should hear page-wide input on the window's capture phase, so that an app's earlier capture-phase stop cannot hide a touch from the gesture recognizers: no current spec record states that, and the cited spec:AST-094 FR1 text is not in the record. An engineering owner records that decision by providing or identifying the governing spec and commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner. Independently of that decision, please address the points below.

  • Land or retarget #8293 and its predecessors so the compare holds only this fix: it currently carries 27,477 authored lines for a 1,532-line change.
  • Correct .changeset/input-stream.md, which calls every listener passive and names a document stopPropagation case that never failed, along with the matching comments and the README's list of blocking listeners.
  • Scope the description, release note and README to what is restored: a pan that must claim its touch (a sheet's pull, or a one-way swipe over a scrollable page) still loses it to the browser's pan under both stops, because its blocking touchmove listener sits on the element below the app's stop.
  • Keep each type's shared listener in place when it switches between passive and cancelling, or loses and regains its last subscriber, or state that limit, since re-adding it lets app listeners registered after Core run before it.

[Automated review]

'@astryxdesign/core': patch
---

[fix] The touch press feedback and the gesture recognizers now listen on the window's capture phase through one shared input stream: one passive listener per event type for both. An app's own capture-phase `stopPropagation` at the document no longer starves them, and a page of pressables registers no listener that can hold a scroll.

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 whole release declaration (AST-017 FR7), and two parts of it do not match the code: the host's touchend, contextmenu and click subscriptions are non-passive while a claimer is attached (GestureHost.ts:1350-1362), and the shared touchmove is non-passive while a page hold listens (pageHold.ts:192). A document-capture stopPropagation never hid a listener on the same node; the cases this fixes are a window-capture stopPropagation and a document-capture stopImmediatePropagation registered before Core.

Comment on lines +121 to +128
view.removeEventListener(type, native.listener, {capture: true});
channel.native = null;
}
if (wanted == null) {
return;
}
const listener: InputListener = event => dispatch(channel, event);
view.addEventListener(type, listener, {capture: true, passive: !wanted});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Removing and re-adding the native listener on a passivity switch (or after the last subscriber leaves) appends it after every window-capture listener registered in the meantime, so an app listener added after Core's first subscription runs before Core from then on, and its stopImmediatePropagation hides the event from every subscriber. Keeping each type's listener in place (for example, leaving touchend, click and contextmenu non-passive once registered), or stating the limit here, would avoid that.

Comment on lines +1424 to +1430
// The window's capture phase, through the shared input stream
// (utils/inputStream.ts): the earliest point a page can intercept input,
// so an app's capture-phase stopPropagation at the document starves no
// recognizer, as UIKit's recognizers see touches before views do. Only
// the listeners that cancel are non-passive, and only while a claimer is
// attached (syncClaimingListeners); none of them is a touchstart or
// touchmove, so none of them holds a scroll.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Two things this comment implies do not hold: a document-capture stopPropagation never starved a listener on the same node, and a recognizer that must claim mid-gesture still cannot under the two stops this does fix, because its blocking touchmove runs on the element or touch target below the app's stop (:886-897, :2103-2107). Worth naming the fixed cases and that a claim still needs the event to reach the element.

vjeux added 5 commits October 27, 2026 05:05
… a mouse press

At the document, an event from inside an open shadow root is retargeted to
the shadow host, and so is a touch's target, so the host looked for
participants from the shadow host and found none inside the root: the
browser then sent its own mousedown and click. Both cases, a finger and a
mouse, attach a tap to an element in the shadow root. Fail until the host
resolves targets through the composed path.
…composed path

Inside an open shadow root the document's listeners see the shadow host,
in event.target and in a touch's target alike, so a recognizer on an
element in the root never got its finger, and nothing claimed it. landedOn
takes the composed path's first element for the event's own target and for
a touch whose target is the event's (another finger keeps its own): a
touch's start, a pointer's press and its pairing, the last touch a scroll
reads, a cancelled pointer's touch and hover.
…he host resolves targets through the composed path) into meta#8320
…s finger: the host resolves targets through the composed path) into meta#8293

# Conflicts:
#	packages/core/src/gestures/GestureHost.ts

@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 Core should hear page-wide input on the window's capture phase, so that an app's earlier capture-phase stop cannot hide a touch from the gesture recognizers: no current spec record states that, and the cited spec:AST-094 FR1 text is not in the record. An engineering owner records that decision by providing or identifying the governing spec and commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner. Independently of that decision, please address the points below.

  • Land or retarget #8293 and its predecessors so the compare holds only this fix: it currently carries 27,532 authored lines for a 1,532-line change.
  • Scope the description, release note and comments to what is restored, and cover both stop cases with a real-touch browser test: a pan that must claim its touch (a sheet's pull, a one-way swipe over a scrollable page) still loses it to the browser under both stops, because its blocking touchmove listener sits on the element below the app's stop.
  • Correct .changeset/input-stream.md, which calls every listener passive and names a document stopPropagation case that never failed, and state that the stream stays first on the window only until an event type's next passivity switch.

[Automated review]

'@astryxdesign/core': patch
---

[fix] The touch press feedback and the gesture recognizers now listen on the window's capture phase through one shared input stream: one passive listener per event type for both. An app's own capture-phase `stopPropagation` at the document no longer starves them, and a page of pressables registers no listener that can hold a scroll.

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 declares "one passive listener per event type" and a fixed document stopPropagation case, but the host's touchend, click and contextmenu subscriptions cancel while a claimer is attached, the page hold's touchmove cancels while held, and a document-capture stopPropagation never stopped a listener on the same node. The cases that changed are a window-capture stopPropagation and a document-capture stopImmediatePropagation registered before Core; please name those and say which subscriptions cancel.

Comment on lines +906 to +910
if (needsListener && !registration.hasTouchMoveListener) {
element.addEventListener('touchmove', this.onBlockingTouchMove, {
passive: false,
});
registration.hasTouchMoveListener = 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 element listener is where a recognizer claims its touch, and it sits below an app's window-capture stopPropagation or document-capture stopImmediatePropagation. Under those stops the stream hears the touch, but a pan that shares an axis with native scrolling still cannot cancel the browser's pan and is cancelled when the browser takes the touch, so the description's "a sheet can't be dragged" case stays broken there. Please scope the claim to what is restored and cover both stops with a real-touch browser test.

return;
}
const listener: InputListener = event => dispatch(channel, event);
view.addEventListener(type, listener, {capture: true, passive: !wanted});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Every passivity switch, and every re-subscription after a type's last subscriber leaves, re-adds this listener at the end of the window's capture list, so an app listener added after Core's first subscription runs first from then on. AST-094 FR19 and FR20 make those switches necessary, so please state that limit where the module says the window's capture phase is the earliest point.

}
this.isBlockingForMovers = needed;
if (needed) {
this.doc.addEventListener('touchmove', this.onBlockingTouchMove, {

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 non-passive touchmove on the document while a claiming element moves goes beyond AST-094 FR19, which allows the blocking listener only on "an element with a recognizer that must claim mid-gesture". This comes with #8293; it belongs in that pull request, conformed or with FR19 amended.

vjeux added 5 commits October 27, 2026 07:08
…adow root; a claimed touch's moves are cancelled where fingers come from pointer events

With targets from the composed path, a finger inside an open shadow root
sits below the scroller only along the flat tree, which Node.contains does
not follow: a scroll under it did not take it, and its flick did not arm
the scroll brake. And where the host reads fingers from pointer events
(inputMode 'auto' with no ontouchstart), the blocking touchmove found no
finger for a claimed pan's touch, so its moves went to the page. Three
cases fail until the host compares along the flat tree and finds that
finger; a fourth pins a finger scroll inside a shadow root.
… tree; a claimed touch finds its pointer finger wherever fingers come from pointer events

containsAlongFlatTree walks parentAcrossShadow, so a finger inside an open
shadow root, now that targets come from the composed path, counts as under
a scroller outside it: a scroll there takes it, its flick arms the scroll
brake, and a touch there brakes. cancelIfClaimed matches a touch to its
pointer finger whenever the host reads fingers from pointer events, not
only under inputMode 'pointer-events', so a claimed pan's moves are
cancelled where a browser that exposes no ontouchstart still sends Touch
Events.
… flat tree, and a claimed touch finds its pointer finger wherever fingers come from pointer events) into meta#8320
…r along the flat tree, and a claimed touch finds its pointer finger wherever fingers come from pointer events) into meta#8293
…r along the flat tree, and a claimed touch finds its pointer finger wherever fingers come from pointer events) into meta#8356

@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 Core should hear page-wide input on the window's capture phase, so that an app's earlier capture-phase stop cannot hide a touch from the gesture recognizers: no current spec record states that, and the cited spec:AST-094 FR1 text is not in the record. An engineering owner records that decision by providing or identifying the governing spec and commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner. Independently of that decision, please address the points below.

  • Land or retarget #8293 and its predecessors so the compare holds only this fix: it currently carries 27,652 authored lines for a 1,532-line change.
  • Correct .changeset/input-stream.md, which calls every listener passive and names a document stopPropagation case that never failed, along with the matching comments and README text.
  • Scope the description, release note and comments to what is restored, and cover both stop cases with a real-touch browser test: a pan that must claim its touch (a sheet's pull, a one-way swipe over a scrollable page) still loses it to the browser under both stops, because its blocking touchmove listener sits on the element below the app's stop.
  • State that the stream stays first on the window only until an event type's next passivity switch, which re-adds its listener behind app listeners registered after Core.

[Automated review]

@vjeux

vjeux commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

Closing: carried by #8360 (this head, 886749b, is in it by hash). The review items:

  • a record for listening on the window's capture phase: still the owner's decision;
  • the release note's passivity claim and its document stopPropagation case, with the comments and README: 38acf83 in fix(core): one click guard for the menu press model and the gesture host #8360 names the two stops actually fixed and the subscriptions that cancel;
  • scoping the claim, and real-touch proofs of both stops: 38acf83 says a claim still needs the touch to reach its element; 2e2f92a proves a tap is heard under both stops;
  • the stream staying first only until a type's listener is re-added: 38acf83.

This branch was successfully deployed

1 active deployment
Preview — 886749ba Deployed Oct 27, 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