Skip to content

feat(gestures): a recognizer created with claimsTouches: false is a watcher - #8589

Closed
cixzhang wants to merge 1042 commits into
mainfrom
uikit/gesture-watcher
Closed

cixzhang wants to merge 1042 commits into
mainfrom
uikit/gesture-watcher

Conversation

@cixzhang

Copy link
Copy Markdown
Contributor

Depends on #8315 (and its predecessors); review this pull request's own commit (feat(gestures): a recognizer created with claimsTouches: false is a watcher), about 210 lines over #8315's head.

Split out of #8336, which keeps the gesture host's ownership changes.

User need

Some touch behavior only follows the person's scroll and never takes the touch: a tab bar that minimizes while the page scrolls down, a header that collapses. It has to see the finger without delaying the scroll, without stopping another recognizer, and without cancelling a press or click under it.

Problem and solution fit

  • claimsTouches: false makes a recognizer a watcher: it never claims, so its element gets only passive listeners and a scroll never waits for it.
  • It prevents no other recognizer and none prevents it, as spec:AST-094 FR15 now states for watchers (spec(AST-094): FR15 exempts watchers from recognizer exclusivity (DEC-7) #8517).
  • It cancels no press or click under it when it begins (FR11, FR19).
  • Its direction writes no touch-action: it restricts no scroll (FR20, DEC-7).
  • It keeps tracking a touch the browser takes for a scroll, reporting through the native scroll and ending at the lift (FR20, DEC-7).

Current specification

spec:AST-094 FR11, FR15, FR19, FR20, DEC-7.

Public delta and caller burden

None: an internal recognizer option, not exported from the package entry point; the changeset is [chore].

Design and alternatives

  • One option on the base recognizer, so any recognizer kind can watch; a separate watcher class would duplicate each recognizer's tracking.

Evidence

  • Unit tests (watcherRecognizer.test.ts): runs alongside a claiming pan on the same touch and claims nothing; cancels no press under it; follows a touch the browser took for a scroll until the lift; gets only passive touchmove listeners; writes no touch-action for its direction.

Writing rubric results

No record text of its own: AST-094 FR15's watcher exemption is on main (#8517); R1–R6: none.

Scope

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

vjeux and others added 30 commits October 26, 2026 03:27
…ated consumer

The gesture host has no delegated consumers and no scroll handoff, so its
header drops both, and one changeset covers the press tracking, the one
press writer and the hooks. Both texts are cixzhang's from c34bf73 on
#8073, taken verbatim so the next #8076 merges without a conflict.
…s pending

waitForAnimation and watch.started() left pending animations (no start time
yet) out of the running set, so an earlier animation that had finished
answered for the one the action started. A pending animation in scope now
keeps the wait going. Self-test: a short animation ends, then a longer one
starts; the wait returns the longer one (it returned the 40 ms one before).
The README and JSDoc say how a mid-run reverse or replay is misread.

Co-authored-by: Christopher Chedeau <[email protected]>
…ase is one handle, and REDUCED_TRANSITION keeps createAnimator's docs

- attach rebuilt only channels away from identity, so an identity the
  animator held inline over a stylesheet that differs (set({opacity: 1}) over
  opacity 0) was never written on the node that replaced the element; the
  new node showed 0 while get() read 1. The held identities now carry through
  a detach to the next node.
- decay under Reduce Motion with one axis past an edge and another coasting
  returned a handle that covered only the coasting axis; stop() left the
  cross-fade to land. The handle now covers both calls.
- REDUCED_TRANSITION moves above createAnimator's doc comment.
Storybook's highlight module scans the page on every insertion in WebKit as in Chromium, so the self-test now counts the insertion's getComputedStyle calls in both engines; only Chromium's trace counts the style recalculations they force. It no longer serves Storybook for an engine it skips.
…handle for a mixed release); decay's Reduce Motion docs

- attach(): #8055's held identities, plus a pseudo-element's: its identity
  hold (a static animation the attach cancels) is held again on the next
  node; a borrowed opacity is never held. Test: a ::backdrop's hold follows
  a node replacement.
- decay(): #8055's single handle for a release with one axis past an edge,
  with `started` covering both calls. Under this layer's plan a stop
  finishes the cross-fade and lands that axis at once, while invisible, so
  #8055's test checks that nothing moves after the stop.
- Docs: the header, decay()'s and MotionCurve's comments, the motion
  README and the changeset now say that a curve marked isTransition (a
  coast's spring back from past an edge) plays through the Reduce Motion
  policy: a cross-fade on a coarse pointer, at once elsewhere.
…lacement, one handle for a mixed-axis release) as a dependency
…e animations

Inside a trace, waitForRest waits on timers for each animation's scheduled
end. A scroll- or view-timeline animation (DateInput's wheel rows) has none:
its time is a percentage, the wait came out NaN, and the timer re-armed with
no delay until the deadline, where the untraced wait rests. It now skips
animations that are not on the document timeline, as holdAnimations does.
Self-test: a scroll-timeline row inside a trace; it rejected at the deadline
before (Chromium, 3x repeat pass).
…t moved frame, and the harness's waits run on the real timers

With a compositor record, the moved criterion counted every compositor
frame in the judged part, but only a gap between two moved frames can be
credited to the compositor, so the frames before the first and after the
last moved frame read as misses: at one screencast frame in six, a
composited animation failed in 5 of 7 runs, where the same frames passed
without the record. The criterion now counts the compositor's frames from
the first to the last moved frame; the gaps before and after are the stall
check's, which already measures the window's edges.

blockMainThread(..., {during}) and sampleRects waited on the page's own
requestAnimationFrame and setTimeout, which freezeTimers holds, so neither
settled under a frozen timer gate, though the harness's own waits are
documented as not held. They now run on the gate's real frame and timeout
(the gate exposes its real setTimeout too). A unit case at one frame in six
and a self-test under a frozen gate fail on the previous code.
…up a wait

waitForAnimation and watch.started() counted a scroll- or view-timeline
animation (DateInput's wheel rows) as running; it never progresses on its
own, so the wait never answered with the animation that finished and
rejected at its timeout. Only document-timeline animations count now, as for
holdAnimations. Self-test: a scroll-timeline row beside a short animation
that ends; it rejected before (Chromium, 3x repeat pass). The installCurveEnd
doc comment sits above installCurveEnd again.

Co-authored-by: Christopher Chedeau <[email protected]>
…s this layer has, and coast says a transition lands at once on a fine pointer
… pointer); the changeset says the same

animator.test.ts keeps this layer's header (no compositor browser spec in
this layer). The changeset now says decay sends a spring back from past an
edge through the Reduce Motion policy: a cross-fade on a coarse pointer, at
once elsewhere.
…side a scroll view

The press profiles' README said a cell's highlight always waits the
content-touch delay. PressTracker waits it inside a scroll view and lights
at once outside one (spec:AST-094 FR11), as its own header says; the README
now says so too.
What one call becomes under Reduce Motion (an opacity-only cross-fade
whose travel lands while the element is transparent, or everything at
once; a dip on a borrowed stylesheet opacity) moves from createAnimator's
closure to reducedMotionPlan.ts, a pure planner that reads the animator
through a view and returns the plan; the animator turns the plan into its
segments and runs the landings. No behavior change: the animator's tests
pass unchanged, and the planner has its own.

Co-authored-by: Christopher Chedeau <[email protected]>
…ed pull requests

This pull request keeps the animator's Reduce Motion plan (now its own
planner module), the browser-set start of a call from rest, promotion,
atRest, rebase and animatorFor. Two features it carried move up the stack,
each with its own tests and changeset:
- play(curves), baking any closed-form curve like a spring;
- driving a pseudo-element (a dialog's ::backdrop).
The changeset is split the same way.

Co-authored-by: Christopher Chedeau <[email protected]>
play(curves) bakes any curve given as value and velocity functions of
time (a spring chasing a moving target from solveSpringTowardRamp, a
fitted UIKit curve) exactly like a spring: presentation values,
velocities, stop, finished and the shared clock work the same, a later
animate starts from the curve's value and velocity, and under Reduce
Motion a curve that moves is travel the policy replaces. Tests and a
changeset of its own.

Co-authored-by: Christopher Chedeau <[email protected]>
createAnimator(element, {pseudoElement: '::backdrop'}) animates a
pseudo-element: with no inline style, a static filling animation holds
its value after a curve ends and after set; a custom property on its host
promotes it; a Reduce Motion dip borrows and hands back the
pseudo-element's own opacity, and its holds follow a node replacement.
animatorFor keeps one animator per element and pseudo-element. Tests and
a changeset of its own.

Co-authored-by: Christopher Chedeau <[email protected]>
…ot the page's frames around it

"a harness read inside a trace is not the page's long task…" also asserted
that no long task started anywhere in the read's window. On CI's runner each
frame of the fixture's 1,200 running rows took 51-54 ms, the page's own long
tasks, and failed it; at 4x CPU locally they take 126-220 ms. The read
itself was set apart correctly.

The test now asserts the read's own classification, and removes the rows
before the timer, click and direct-call windows, so each holds only its own
work. It passes at 4x CPU, where the previous assertion failed.
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026
…8589's watcher test reads its end; the gestures-table gate retired) into meta#8360
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026
fZ retires the long-press check that kept DropdownMenu off the gestures table (meta#8358) and carries meta#8589's watcher-test fix and meta#8076 e6ab0b9.
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026
's base

fZ carries meta#8076 e6ab0b9 (DEC-22's 10 px rule and meta#8641's arena fix),
the meta#8589 watcher-test fix and the meta#8358 gate retirement; taken at this
stack's real push (LANES 01:13).
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026
vjeux pushed a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
…via meta#8076) into the host line

useGestureRecognizer keeps both fine-pointer options: this PR's
perEventPointer and meta#8309's actionGroup.
vjeux pushed a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
…via meta#8076) into the host line

useGestureRecognizer keeps both fine-pointer options: this PR's
perEventPointer and meta#8309's actionGroup.
vjeux pushed a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
…r watchers) into the host line

The host keeps this PR's isRtlElement and its fingers held before a
recognizer begins (a kept press, a scroll-edge pan), beside meta#8061's view
size and meta#8309's pointer-events finger lookup. meta#8589's claimer check
counts only participants active on this pointer (isActive,
isConsumerActive), and a group press's click listener now stays while a
claimer keeps it installed. The browser spec keeps the fine-pointer
describe beside the FR18-FR22 real-touch states.
vjeux pushed a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
…'s passive-only watcher listeners) into the arena fixes

The host-owner changeset keeps this PR's own listeners for the scroll
lock and finger-scroll watch, and adds meta#8336's scroll-edge hold.
vjeux pushed a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
vjeux pushed a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
…r watchers) into the host line

The host keeps this PR's isRtlElement and its fingers held before a
recognizer begins (a kept press, a scroll-edge pan), beside meta#8061's view
size and meta#8309's pointer-events finger lookup. meta#8589's claimer check
counts only participants active on this pointer (isActive,
isConsumerActive), and a group press's click listener now stays while a
claimer keeps it installed. The browser spec keeps the fine-pointer
describe beside the FR18-FR22 real-touch states.
vjeux pushed a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
…'s passive-only watcher listeners) into the arena fixes

The host-owner changeset keeps this PR's own listeners for the scroll
lock and finger-scroll watch, and adds meta#8336's scroll-edge hold.
vjeux pushed a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
cixzhang's meta#8589 keeps the host's touchend passive, and its contextmenu
and click listeners off, until a claimer is attached
(syncClaimingListeners). Ported onto this pull request's input stream with
no change to what it does: install() subscribes the touchend passive, and
syncClaimingListeners swaps it for a cancelling subscription and adds the
contextmenu and click subscriptions while a claimer is attached. A group
press brings its own click subscription only while the host has none, and
the host's takes it over. Her watcher test reads those listeners on the
window, where the input stream registers them; her new group test (a
finger, then a mouse, under a fine pointer) sits before the detach test.
The test file and the bare fixture import both her
ScreenEdgePanGestureRecognizer and this layer's selection lock from utils.
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
Here the click guard (utils/clickGuard.ts) owns clicks, so cixzhang's
meta#8589 syncClaimingListeners, ported at meta#8356, switches only the touchend's
cancelability and the contextmenu subscription; the group press subscribes
no click of its own. Her meta#8072 5c59af1 (a finger on an action group
under a fine pointer reaches its recognizers) arms the click guard where it
armed the swallower. Her watcher test reads the touchend and the
contextmenu on the window, and no click listener: the guard's comes only
once a gesture acts.
vjeux pushed a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
vjeux pushed a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
…s watcher browser test) into the arena fixes
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
cixzhang's meta#8589 keeps the host's touchend passive, and its contextmenu
and click listeners off, until a claimer is attached
(syncClaimingListeners). Ported onto this pull request's input stream with
no change to what it does: install() subscribes the touchend passive, and
syncClaimingListeners swaps it for a cancelling subscription and adds the
contextmenu and click subscriptions while a claimer is attached. A group
press brings its own click subscription only while the host has none, and
the host's takes it over. Her watcher test reads those listeners on the
window, where the input stream registers them; her new group test (a
finger, then a mouse, under a fine pointer) sits before the detach test.
The test file and the bare fixture import both her
ScreenEdgePanGestureRecognizer and this layer's selection lock from utils.
vjeux pushed a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
Here the click guard (utils/clickGuard.ts) owns clicks, so cixzhang's
meta#8589 syncClaimingListeners, ported at meta#8356, switches only the touchend's
cancelability and the contextmenu subscription; the group press subscribes
no click of its own. Her meta#8072 5c59af1 (a finger on an action group
under a fine pointer reaches its recognizers) arms the click guard where it
armed the swallower. Her watcher test reads the touchend and the
contextmenu on the window, and no click listener: the guard's comes only
once a gesture acts.
vjeux pushed a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
vjeux pushed a commit to vjeux/astryx that referenced this pull request Nov 3, 2026
…s watcher browser test) into the arena fixes
vjeux pushed a commit to vjeux/astryx that referenced this pull request Nov 3, 2026

This branch had an error being deployed

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