Skip to content

feat(core): a held finger never starts text selection where its hold does something - #8270

Closed
vjeux wants to merge 879 commits into
meta:mainfrom
vjeux:uikit/f2-touch-no-select
Closed

vjeux wants to merge 879 commits into
meta:mainfrom
vjeux:uikit/f2-touch-no-select

Conversation

@vjeux

@vjeux vjeux commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Depends on #8076. Review only this pull request's change: vjeux/astryx@3fb31dd...170162d

Why

On a phone, a finger resting on a slider's thumb or a switch starts a text selection or the loupe, and a long press on a context-menu trigger can bring up the iOS callout over the menu. UIKit never selects text under a control whose hold does something.

What led to it

This is part of the UIKit-parity work on Astryx's touch components. The approved gesture spec says a held finger does what the hold does, not a selection, and that anything whose hold does nothing keeps the browser's long-press selection (spec:AST-094 FR41).

Options and tradeoffs

  • Turn selection off with CSS on every touch component, always: simple, but a label or a row would lose selection people expect, and the style would repaint.
  • Turn it off only during a hold, only on elements whose hold acts: precise, but it needs each such recognizer to say so.
  • Do the second through the gesture host, with an opt-in selectionLock option on the recognizers whose drag acts (a slider's thumb, a switch's drag), and the long press bringing its own.

Why this choice

Only elements whose hold does something lose selection, and only for that press, lifted at the lift or a cancel. A plain control, a row or a label keeps native selection. Where iOS WebKit runs (it sends no selectstart for a long press), the lock uses user-select and the callout over the held elements; elsewhere it cancels selectstart and writes no style, so nothing repaints. A non-text input inside a locked element locks too; text fields never do. At this pull request it applies where the primary pointer is coarse; #8665 extends it to every primary pointer, as the merged FR41 now reads, with a mouse always excluded.

How to check it

  1. On a phone, rest a finger on a slider's thumb for a second. Expected: no selection or loupe; dragging moves the thumb.
  2. Long-press a context-menu trigger. Expected: the menu opens, with no iOS callout and no selection.
  3. Long-press a plain text label. Expected: the browser selects the text as usual.
  4. Long-press a checkbox inside a plain row. Expected: native behavior, no lock.

Evidence

  • Real touch in Chromium and WebKit: a plain control keeps selection under a hold; a long press and a pan that asks refuse it until the lift; a checkbox inside a switch's drag locks, one in a plain row does not; a zero-delay hold locks only for a touch it takes.
  • Known CI red: test-ui (4/4) fails on the CodeBlockHeaderPlugin race that test(richtext): the code block header tests wait for the copy button's tooltip #8569 fixes; it is unrelated to this change.

@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 Error Error Oct 27, 2026 10:36am 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
🟡 Reviewed (for maintainers only) Oct 27, 2026, 11:03 AM UTC

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

@astracat-bot astracat-bot Bot 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 can't be approved yet. The selection lock rests only on spec:AST-094, a draft that main does not have, and none of its requirements (FR19 included) says that a held finger or pen turns off text selection and the callout on press-tracked elements or on recognizers with preventsTextSelection. An engineering owner needs to approve that requirement, for example by adding it to AST-094, and records the decision by commenting /approve-spec <full head SHA> on this pull request; the author may do so if they are an engineering owner. Whatever that decision, these changes are needed:

  • Land the stacked predecessors first and rebase, so this pull request carries the 296-line lock commit instead of 28,738 lines across 167 files.
  • The new platform adaptation condition (themeAdaptations.ts:82) conflicts with the theme authoring contract's fixed condition vocabulary, and the new adaptive query (utils/touchPresentation.ts:78-79) conflicts with Selector DEC-1's width-and-pointer query.
  • Draft FR4 says touch motion is not themable, while the branch ships defineTheme motion roles that retune it; one of the two has to change.
  • lockSelection (GestureHost.ts:614-621) also locks for a disabled or pointer-excluded recognizer; skip those, as a declined press already is.

[Automated review]

Comment on lines +614 to +621
for (const recognizer of recognizers) {
if (
recognizer.preventsTextSelection &&
recognizer.view instanceof Element
) {
elements.add(recognizer.view);
}
}

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 adds every recognizer on the path that has preventsTextSelection, including one whose isEnabled is false or whose allowedPointerTypes excludes this contact. Both make acceptsTouch decline the touch (GestureRecognizer.ts:428-437), so a disabled slider would still turn selection off under a finger, unlike a declined press, which you deliberately leave unlocked. Consider skipping recognizers that would decline this contact, and adding a unit case for a disabled recognizer.

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

platform adds an axis to the adaptation condition vocabulary. The theme authoring contract on main says "An adaptation change preserves the fixed condition vocabulary" (docs/architecture/theme-authoring-contract.md, line 241). This needs an owner amendment of that contract (and of AST-012's closed conditions) before it ships, or it should come out of the stack.

Comment on lines +78 to +79
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.

This query feeds COMPACT_TOUCH_PRESENTATION_QUERY, so Selector's default presentation and four other components change surface: coarse-pointer viewports 744-768px wide (and at least 500px tall) move from the sheet to the popover, and landscape phones wider than 768px move to the sheet. Selector DEC-1 on main says "adaptive keeps its width-and-pointer query", and the height branch is outside that text.

vjeux added a commit to vjeux/astryx that referenced this pull request Oct 24, 2026
With the press tracker in place no recognizer claimed the touch, and iOS
Safari's long-press text selection started on the held segment's title (the
per-path simulator recording showed the selection handles and the loupe).
The horizontal pan now sets preventsTextSelection, so the gesture host turns
text selection and the touch callout off on the track while a finger is down
(meta#8270; the press tracker's element gets the same lock) and gives them back
at the lift. At rest, and under a mouse, titles stay selectable. The tap
slide's test now holds the lens's animations at their birth, so a slow
engine cannot reach the hold after the lift's own curves have ended.
@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Preview availability: Storybook and Sandbox are not both ready on the exact-head Vercel preview. CI concluded failure.

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 66.6KB +297B 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 54.3KB +244B 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 +281B 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 78.0KB +275B 14.6KB 14.6KB 0B
core/ContextMenuItem 16.6KB 16.8KB +280B 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 73.0KB +278B 14.7KB 14.7KB 0B
core/DropdownMenuCheckboxItem 16.1KB 16.4KB +284B 5.6KB 5.6KB 0B
core/DropdownMenuItem 15.4KB 15.7KB +287B 5.2KB 5.2KB 0B
core/DropdownMenuRadioItem 16.2KB 16.5KB +275B 5.6KB 5.6KB 0B
core/DropdownMenuSubMenu 58.1KB 58.3KB +270B 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 11.6KB +273B 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/ListItem 53.5KB 53.7KB +268B 10.5KB 10.5KB 0B
core/Markdown 144.5KB 144.7KB +247B 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 73.2KB +278B 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 88.0KB +263B 15.3KB 15.3KB 0B
core/Popover 49.8KB 50.1KB +238B 12.1KB 12.1KB 0B
core/PowerSearch 155.1KB 155.3KB +263B 18.6KB 18.6KB 0B
core/RadioListItem 52.1KB 52.4KB +286B 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 79.4KB +268B 15.0KB 15.0KB 0B
core/SelectorOption 14.5KB 14.8KB +251B 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 84.2KB +253B 15.1KB 15.1KB 0B
core/TableCell 78.8KB 79.1KB +267B 14.8KB 14.8KB 0B
core/TableHeaderCell 78.6KB 78.8KB +272B 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.

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 | View full report

vjeux added a commit to vjeux/astryx that referenced this pull request Oct 24, 2026
With the press tracker in place no recognizer claimed the touch, and iOS
Safari's long-press text selection started on the held segment's title (the
per-path simulator recording showed the selection handles and the loupe).
The horizontal pan now sets preventsTextSelection, so the gesture host turns
text selection and the touch callout off on the track while a finger is down
(meta#8270; the press tracker's element gets the same lock) and gives them back
at the lift. At rest, and under a mouse, titles stay selectable. The tap
slide's test now holds the lens's animations at their birth, so a slow
engine cannot reach the hold after the lift's own curves have ended.
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 24, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 24, 2026
With the press tracker in place no recognizer claimed the touch, and iOS
Safari's long-press text selection started on the held segment's title (the
per-path simulator recording showed the selection handles and the loupe).
The horizontal pan now sets preventsTextSelection, so the gesture host turns
text selection and the touch callout off on the track while a finger is down
(meta#8270; the press tracker's element gets the same lock) and gives them back
at the lift. At rest, and under a mouse, titles stay selectable. The tap
slide's test now holds the lens's animations at their birth, so a slow
engine cannot reach the hold after the lift's own curves have ended.
@vjeux
vjeux force-pushed the uikit/f2-touch-no-select branch from 3e9cf5f to 009f2c8 Compare October 24, 2026 21:27

@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 can't be approved yet: the selection lock, including the new extension to checkboxes, radios and switch inputs, rests only on spec:AST-094, a draft that main does not have, and none of its requirements (FR19 included) says that a held finger or pen turns off text selection and the callout. An engineering owner needs to approve that requirement, for example by adding it to AST-094, and records the decision by commenting /approve-spec <full head SHA> on this pull request; the author may do so if they are an engineering owner. Whatever that decision, these changes are needed:

  • Land the stacked predecessors first and rebase, so this pull request carries the 401-line lock commit instead of 28,843 lines across 167 files.
  • The compact-touch query hard-codes 744px (utils/touchPresentation.ts:75-79), while spec:AST-012 FR9 and the public component API record (INV17) on main define compact as width below the theme's md point (768 by default) or height below 500 with no numbers of its own, and the presentation Changeset should name presentation as the way to keep a surface.
  • The new platform adaptation condition (themeAdaptations.ts:82) is outside the closed condition vocabulary of AST-012 FR2.
  • The defineTheme motion roles are documented as retuning touch motion that no component plays yet, and their validation runs only when the experimental motion tables happen to be loaded, so a misspelled role id passes silently.
  • lockSelection (GestureHost.ts:617-624) still locks for a disabled or pointer-excluded recognizer, and the useGestureRecognizer enable effect calls onGesture from inside the effect.
  • Draft FR4 says touch motion is not themable while the branch ships themable motion roles, so one of the two has to change.

[Automated review]

Comment on lines +75 to +79
export const COMPACT_QUERY = '(width < 744px), (height < 500px)';

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

This width is the resolver's own number. spec:AST-012 FR9 on main makes a screen compact while its width is below the theme's effective md point (768 by default) or its height is below 500, and says the web touch presentation resolver keeps no size numbers of its own; architecture:public-component-api INV17 says the same. At 744-767 px wide with a coarse pointer, adaptive Selector, MultiSelector, DropdownMenu, ContextMenu and MoreMenu now open the popover where FR9 asks for the sheet. The height edge matches FR9; the width edge should come from the theme's md point.

Comment on lines +83 to +85
useIsomorphicLayoutEffect(() => {
recognizer.setEnabled(isEnabled);
}, [recognizer, isEnabled]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Turning isEnabled off mid-gesture cancels the recognizer here, and its listeners run synchronously (GestureRecognizer.ts:569-574, :603-606), so the consumer's onGesture fires from inside this layout effect. architecture:react-component-runtime INV2 keeps consumer callbacks out of effects, and INV3 asks each effect to name the external system it synchronizes; a comment naming the recognizer and justifying the cancellation callback, or delivering it outside the effect, would settle it.

Comment on lines +140 to +145
const registered = motionRole(id);
if (registered !== undefined && registered.kind !== kind) {
throw new Error(
`${location}: "${id}" is a ${registered.kind}; set it under the matching group.`,
);
}

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 check only runs when the motion tables are registered, and they register themselves from motion/uikit/*.ts on import, which the defineTheme path never does. Through defineTheme alone, a spring role under durations passes and a misspelled id such as springs.sheetPresnt becomes --motion-springs-sheet-presnt with no error, while an app where the tables happen to be loaded (for example through the uikit namespace of @astryxdesign/core/motion/experimental) gets the error. Validating against the registered roles in this path, and rejecting ids no table registers, would make the same theme behave the same everywhere.

vjeux added a commit to vjeux/astryx that referenced this pull request Oct 24, 2026
With the press tracker in place no recognizer claimed the touch, and iOS
Safari's long-press text selection started on the held segment's title (the
per-path simulator recording showed the selection handles and the loupe).
The horizontal pan now sets preventsTextSelection, so the gesture host turns
text selection and the touch callout off on the track while a finger is down
(meta#8270; the press tracker's element gets the same lock) and gives them back
at the lift. At rest, and under a mouse, titles stay selectable. The tap
slide's test now holds the lens's animations at their birth, so a slow
engine cannot reach the hold after the lift's own curves have ended.
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 24, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 24, 2026
cixzhang and others added 7 commits October 26, 2026 18:17
…ond route around ./internal/*

Lab's per-module tsconfig paths (core's motion, gestures and
touchPresentation) and the Sandbox/docsite resolver that served them opened
a route around architecture:react-component-runtime INV13's ./internal/*
subpath exports. Nothing in Lab imports those paths here; they're dropped,
and the import guard now fails on any Lab import core doesn't export and on
any Lab tsconfig alias for core.

Co-authored-by: Christopher Chedeau <vjeux@users.noreply.github.com>
 landed) into the experimental touch layer

# Conflicts:
#	packages/core/src/motion/README.md
… detaches

The deferred unmount demotes the detached node, and demote asks for a fresh
will-change read; the detached node now gets none, so no timer outlives the
element (architecture:react-component-runtime INV5).

Co-authored-by: Christopher Chedeau <vjeux@users.noreply.github.com>
… that finger until it lifts (spec:AST-094 FR14)

A recognition that claimed its touches and was then cancelled gave them
back to the browser unless another recognition owned them, so a finger
resting there could pinch-zoom the page. A gesture that cancels itself on
a finger's move, a long press dragged past its tolerance after it began,
gave back a finger that was dragging: the host stopped cancelling its moves
and the page scrolled the rest of the drag, a hand change FR14 forbids and
UIKit never makes (its scroll view never takes a touch another recognizer
had). A cancel during a finger's move now keeps that finger claimed until
it lifts; a resting finger is given back as before, and a waiting
recognition that fails still gives its claim back.

The new arena case fails on the previous code: the dragging finger reads
unclaimed right after the cancel.
…edge-zone strip decides at UIKit's 15 px

The host's arena environment had no viewSize, so under the real host a
screen-edge pan never saw its edge zone while a touch was down and decided
at 10 px, while its attach-time touch-action (read through the default
environment) had already claimed the axis (spec:AST-094 FR18).

Co-authored-by: Christopher Chedeau <vjeux@users.noreply.github.com>
…fter layout rounding

Lane 0's real-host browser spec found a strip authored at the 40.2 px edge
region lays out at 40.203 px (layout snaps to 1/64 px), so the strict
comparison read it as off the zone and the pan decided at 10 px instead of
UIKit's 15 (spec:AST-094 FR18). The zone takes half a pixel of tolerance:
the rounded strip is the zone, a view a pixel wider still is not.
Failing-first test at 40.203 px: it claims pan-x and decides at 15.

Co-authored-by: Christopher Chedeau <vjeuxx@gmail.com>

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

Changes requested: the selection lock itself follows spec:AST-094 FR41 and DEC-9, but the comparison with main still carries the content of 13 open predecessor pull requests, so please land that stack first or rebuild this branch on it, leaving only the lock’s 21 files. The stacked gesture host also contradicts two current claims, which should be fixed before anything attaches it:

  • GestureHost.ts:477-508 writes the derived touch-action over the element’s own value instead of intersecting with it (FR18).
  • GestureHost.ts:1584-1618 lets any scroll event take a still finger’s touch without the 10 px of travel FR20 requires.

[Automated review]

Comment on lines +482 to +497
const style: GestureHostStyle = this.isPrimaryPointerCoarse()
? gestureHostStyle(registration.recognizers.filter(r => r.isEnabled))
: {};
for (const key of Object.keys(
STYLE_PROPERTIES,
) as (keyof GestureHostStyle)[]) {
const property = STYLE_PROPERTIES[key];
const value = style[key];
if (value != null) {
if (!registration.savedStyle.has(property)) {
registration.savedStyle.set(
property,
element.style.getPropertyValue(property),
);
}
element.style.setProperty(property, 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 the derived touch-action over the element’s own value: the saved inline value only comes back at detach, and gestureHostStyle derives from the recognizers alone. An element whose author narrowed touch-action (none on a drawing surface, pan-x on a carousel) is widened once a recognizer attaches. spec:AST-094 FR18: “The derived value is intersected with the element’s own author touch-action and is never wider than it (DEC-8)”. Please intersect with the author’s value before writing, with the verification row’s narrower-author case.

Comment on lines +1600 to +1617
const taken: number[] = [];
for (const touch of this.arena.touches) {
if (
touch.takenByBrowser ||
touch.phase === 'ended' ||
touch.phase === 'cancelled' ||
touch.pointerType !== 'touch' ||
this.arena.isClaimed(touch.id)
) {
continue;
}
if (touch.target instanceof Node && scroller.contains(touch.target)) {
taken.push(touch.id);
}
}
if (taken.length > 0) {
this.arena.browserTookOver(taken, time);
}

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 live, unclaimed finger whose target is inside the scrolling node is handed to browserTookOver here, whatever distance it has moved, so a still finger on a tappable row loses its tap to sub-pixel or programmatic scrolling; the case at __tests__/GestureHost.test.ts:817-826 asserts exactly that. spec:AST-094 FR20: “a native scroll only once that finger has moved the scroll take distance (FR2)”, and DEC-8 rejects “cancelling at the first scroll event”. Please count a scroll only once the finger’s own travel reaches 10 px.

vjeux added 3 commits October 26, 2026 20:13
Main's meta#8521 is its head 25b468c squashed, which this pull request already
carries: every file it touches is byte-identical to 25b468c. In the two
files that conflicted (the motion README and animator.ts), the resolution is
this side's version, main's merged meta#8521 with this pull request's later work
on top. Nothing of main is dropped.
…ta#8521) into meta#8270

# Conflicts:
#	packages/core/src/gestures/__tests__/GestureHost.test.ts
An attach reads the element's own will-change in a task of its own. A
shared animator (animatorFor) is never detached, so its node can leave the
document with that read still waiting, and the read then forces a style
pass on a node with no style: a test run that mounts and unmounts many
pagers piled up such reads until a later wait timed out. The read now
skips a node out of the document; a promotion that needs it reads it then,
as one on a node attached in the same task does. A detach and dispose
already cancel it.

The new test fails on the previous code (one read of a removed node); the
in-task read test now puts its element in the document, where the read
happens.

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

Changes requested: the touch selection lock itself matches AST-094 FR41 and DEC-9, but this pull request still carries the content of 12 open predecessor pull requests, 16,991 changed lines of which 1,735 are the lock’s. Please land the predecessors first, or rebuild this branch on them, so it carries only the lock’s 21 files.

  • The stacked gesture host writes its derived touch-action over the element’s own value (packages/core/src/gestures/GestureHost.ts:486-517), where FR18 requires intersecting it with the author’s value.
  • Its scroll handler hands every unclaimed finger inside a scroller to the browser with no travel check (GestureHost.ts:1593-1627), where FR20 allows that only after 10 px of movement, so the fixes reported in #8309 need to land before anything attaches the host.

[Automated review]

element.style.getPropertyValue(property),
);
}
element.style.setProperty(property, 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 the derived touch-action over the element’s own value and keeps that value only to restore it at detach, so an author’s narrower touch-action (none, pan-x) is widened. Current spec:AST-094 FR18: “The derived value is intersected with the element’s own author touch-action and is never wider than it (DEC-8)”.

}
}
if (taken.length > 0) {
this.arena.browserTookOver(taken, time);

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 live, unclaimed finger inside the scrolling node is handed to the browser here whatever distance it has moved, so a still finger loses its tap to sub-pixel or programmatic scrolling (the case at __tests__/GestureHost.test.ts:838-847 asserts it). Current spec:AST-094 FR20 counts a native scroll only “once that finger has moved the scroll take distance (FR2)”, 10 px.

vjeux added 3 commits October 26, 2026 22:21
…sture system (spec:AST-094 FR24, FR43)

utils/pressFeedback.ts reaches gestures/coarsePointer.ts, so a page whose
only touch work is press feedback carries a gesture module, and a bundle
check that counts gestures/ code finds it in the root and hooks entries.
The coarse-pointer query belongs with the environment queries. This test
walks the controller's import graph and fails until it reaches no module
under gestures/.
…ries in utils/ (spec:AST-094 FR43)

gestures/coarsePointer.ts becomes utils/coarsePointer.ts, beside
utils/touchQueries.ts, with its test; the gesture host's selection lock,
the press controller and the pointer test helper import it from there. The
press controller's import graph now reaches no module under gestures/, so
a page whose only touch work is press feedback carries none of the gesture
system. No behavior changes.

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

Changes requested: the touch selection lock itself matches AST-094 FR41 and DEC-9, but this pull request still carries the content of 12 open predecessor pull requests, 17,093 changed lines of which 1,790 are the lock's. Please land the predecessors first, or rebuild this branch on them, so it carries only the lock's 22 files.

  • The stacked gesture host writes its derived touch-action over the element's own value (packages/core/src/gestures/GestureHost.ts:486-517), where FR18 requires intersecting it with the author's value.
  • Its scroll handler hands every unclaimed finger inside a scroller to the browser with no travel check (GestureHost.ts:1593-1627), where FR20 allows that only after 10 px of movement, so the fixes reported in #8309 need to land before anything attaches the host.
  • packages/core/src/utils/pressFeedbackImports.test.ts:8 cites AST-094 FR43, which the current record does not have; cite FR24 alone until it does.

[Automated review]

* @input The source of utils/pressFeedback.ts and every module it imports
* @output The press feedback controller's import graph reaches no module
* under gestures/: a page whose only touch work is press feedback carries
* none of the gesture system (`spec:AST-094` FR24, FR43: pointer queries

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 on main has no FR43; an FR43 is only proposed in the open spec pull request #8646. Citing it here presents a draft as the requirement behind this import boundary. FR24 ("no touch-only listener, observer or timer is active" where the primary pointer is fine) is the current claim; please cite it alone, or drop the FR43 reference until a current record states it.

vjeux added 7 commits October 26, 2026 23:57
…(spec:AST-094 FR18, DEC-13)

A screen-edge pan attached to a stack container, as wide as the screen,
with a touch 4 px from its edge: inside the 40.2 px band the pan decides at
UIKit's 15 px whatever the element's width, and then tracks the travel past
it. From several edges too. Both fail while a wider element decides at
FR19's 10 px.
…'s width (spec:AST-094 FR18, DEC-13)

FR18: inside the 40.2 px band a screen-edge pan decides at UIKit's 15 px
screen-edge hysteresis; outside it the author's scrolling is untouched and
FR19's 10 px governs every other claim. The pan decided at 10 px on any
element wider than the band, so NavigationStack's edge pan, attached to the
stack container, began 5 px early. The edge zone still decides only the
touch-action; a touch outside every band still fails at once. The two
cases that pinned the 10 px decision go.
… 15 px whatever the element's width) into the experimental touch exports
…er's move keeps that finger until it lifts) into the experimental touch exports
…than the band (spec:AST-094 FR18, DEC-22)

FR18 as amended in meta#8631 (DEC-22): the band's pan-x claim and 15 px start
hold only where the screen-edge pan is attached to an element within the
band; on an element that reaches beyond it, whose touch-action cannot
claim per touch, a touch in the band decides at FR19's 10 px like every
other claim. This restores the 10 px decision 3d85c30 removed and keeps
15 px on an element within the band. The cases pin DEC-22 both ways (a wide
element with a touch at x=4 begins at 10, an in-band strip at 15, and from
several edges at 10 on a wide element); the 10 px cases fail on 3d85c30.
…an the edge band decides at 10 px again, DEC-22) into the experimental touch exports
…ouch decides at 15 px on an element within the band and at 10 px beyond it, DEC-22; meta#8641 bec2283) into meta#8270

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

Changes requested: the touch selection lock itself matches AST-094 FR41 and DEC-9, but this pull request still carries the content of 13 open predecessor pull requests, 17,214 authored changed lines of which 1,790 are the lock's, so please land the predecessors first, or rebuild this branch on them, so it carries only the lock's 22 files.

  • The stacked gesture host writes its derived touch-action over the element's own value (packages/core/src/gestures/GestureHost.ts:486-517, against FR18) and hands every unclaimed finger inside a scroller to the browser with no travel check (GestureHost.ts:1593-1627, against FR20), so the fixes reported in #8309 need to land before anything attaches the host.
  • New at this head, the arena keeps a finger claimed after its gesture cancels on a move (packages/core/src/gestures/GestureArena.ts:643), so the host keeps cancelling that finger's touchmove, which FR19 forbids for a touch no recognizer owns; please settle that in #8641.
  • packages/core/src/utils/pressFeedbackImports.test.ts:8 cites AST-094 FR43, which the current record does not have; cite FR24 alone until it does.

[Automated review]

}
if (next === 'cancelled' || next === 'failed') {
if (next === 'cancelled') {
this.releaseClaim(recognizer, this.movingIds);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

When a claiming recognizer cancels itself during a move, this keeps the moving finger claimed, and the host's blocking listener keeps calling preventDefault() on that finger's touchmove until the lift (GestureHost.ts:898-903), though no recognizer owns it any more; arena.test.ts:526 asserts it. Current spec:AST-094 FR19: "A touchmove of a touch no recognizer owns MUST NOT be cancelled, with three exceptions", and none of them is a cancelled gesture (FR14 governs a drag that starts inside a scroll area). Give the finger back on cancel, as before, or have an engineering owner amend FR19 first.

vjeux added 2 commits October 27, 2026 03:09
…xperimental touch exports

The motion README's Files table is the union: main's rows, with meta#8663's
resolveSnapPoint.ts and selectPage.ts, plus this branch's, in main's
order.

# Conflicts:
#	packages/core/src/motion/README.md

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

Changes requested: the touch selection lock itself matches AST-094 FR41 and DEC-9, but this pull request still carries the content of 13 open predecessor pull requests (17,218 authored changed lines, of which 1,790 are the lock's), so please land the predecessors first, or rebuild this branch on them, so it carries only the lock's 22 files.

  • The stacked gesture host writes its derived touch-action over the element's own value (packages/core/src/gestures/GestureHost.ts:486-517, against FR18) and hands every unclaimed finger inside a scroller to the browser with no travel check (GestureHost.ts:1593-1627, against FR20), so the fixes reported in #8309 need to land before anything attaches the host.
  • The stacked arena keeps a finger claimed after its gesture cancels on a move (packages/core/src/gestures/GestureArena.ts:643), so the host keeps cancelling that finger's touchmove, which FR19 forbids for a touch no recognizer owns; please settle that in #8641.
  • packages/core/src/utils/pressFeedbackImports.test.ts:8 cites AST-094 FR43, which the current record does not have; cite FR24 alone until it does.

[Automated review]

element.style.getPropertyValue(property),
);
}
element.style.setProperty(property, 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 the derived touch-action over the element's own value, so an author who narrowed it (none on a drawing surface, pan-x on a carousel) gets a wider value once a recognizer attaches. AST-094 FR18 requires the derived value to be intersected with the author's touch-action and never wider than it (DEC-8); the fix reported in #8309 needs to land before anything attaches the host.

Comment on lines +1620 to +1622
if (touch.target instanceof Node && scroller.contains(touch.target)) {
taken.push(touch.id);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Any scroll above an unclaimed finger counts as the browser taking it, whatever that finger's travel, so a still finger loses its tap to sub-pixel or programmatic scrolling (the case 'reads a scroll above an unclaimed touch as the browser taking it' asserts this). AST-094 FR20 counts a native scroll only once the finger has moved the 10 px scroll take distance, and DEC-8 rejects cancelling at the first scroll event.

}
if (next === 'cancelled' || next === 'failed') {
if (next === 'cancelled') {
this.releaseClaim(recognizer, this.movingIds);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Keeping the claim on the touches that moved when this recognizer cancelled leaves that finger claimed with no active recognizer owning it, so the host keeps cancelling its touchmove until the lift. AST-094 FR19 forbids cancelling the moves of a touch no recognizer owns outside its three exceptions, and FR14 decides who takes a drag that starts inside a scroll area rather than this case; please settle it in #8641.

* @input The source of utils/pressFeedback.ts and every module it imports
* @output The press feedback controller's import graph reaches no module
* under gestures/: a page whose only touch work is press feedback carries
* none of the gesture system (`spec:AST-094` FR24, FR43: pointer queries

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-094 ends at FR42 and has no FR43, so this citation points at nothing; cite FR24 alone until a current claim states the rule.

@vjeux

vjeux commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

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

This branch had an error being deployed

1 failed deployment
Preview — 170162d8 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