Repository navigation
fix(gestures): read a finger's lift on the clock its moves came on - #10583
Conversation
GestureHost reads a finger's moves from its pointer events, but read its lift from the touchend. WebKit stamps that touchend only once the page's pointerup listeners are done, so a busy listener made a fast flick read as a resting finger, and a tap lifted in time read as a long press. A finger sampled from its pointer events now lifts at its pointerup's place and time: the lift and the moves share one channel. A finger with no paired pointerup keeps the touchend's. A touchend's lifts reach the arena in time order, so none is raised to a later one. iOS and Chromium stamp both events alike, so nothing changes there.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC |
|---|---|---|
| Lightbox | 111.1 kB (+114 B) · 10.3 kB CSS (0) | — |
| lab/Schedule | 104.4 kB (+114 B) · 3.9 kB CSS (0) | — |
| lab/NavigationScreen | 79.5 kB (+109 B) · 1.5 kB CSS (0) | — |
16 more components
| Component | Size | LoC |
|---|---|---|
| lab/NavigationStack | 79.5 kB (+109 B) · 1.5 kB CSS (0) | — |
| Switch | 100.6 kB (+108 B) · 9.9 kB CSS (0) | — |
| ButtonGroup | 41.3 kB (+107 B) · 3.7 kB CSS (0) | — |
| lab/TabBar | 74.0 kB (+107 B) · 1.8 kB CSS (0) | — |
| AlertDialog | 104.1 kB (+106 B) · 14.3 kB CSS (0) | — |
| DateInput | 182.4 kB (+106 B) · 16.7 kB CSS (0) | — |
| Toast | 97.0 kB (+105 B) · 10.2 kB CSS (0) | — |
| Slider | 106.0 kB (+101 B) · 8.7 kB CSS (0) | — |
| lab/Comments | 324.6 kB (+101 B) · 2.5 kB CSS (0) | — |
| PowerSearch | 281.3 kB (+99 B) · 23.5 kB CSS (0) | — |
| TimeInput | 158.3 kB (+99 B) · 15.7 kB CSS (0) | — |
| lab/PageControl | 72.7 kB (+98 B) · 709 B CSS (0) | — |
| DateTimeInput | 204.0 kB (+97 B) · 18.4 kB CSS (0) | — |
| SegmentedControl | 92.4 kB (+94 B) · 6.8 kB CSS (0) | — |
| lab/CommentThread | 319.5 kB (+87 B) · 2.4 kB CSS (0) | — |
| lab/TabBarItem | 3.8 kB (0) · 1.8 kB CSS (0) | — |
Package size: @astryxdesign/core 6.92 MB packed (+729 B); no new dependencies.
API changes: none in this pull request
Committed API report behind this build: cli 21 rows, core 33 rows; run pnpm api:report.
Not run on this PR: add ci:run-visual, ci:run-a11y or ci:run-rtl to run them.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet. This is a draft from a fork, so CI starts once it is marked ready for review and a maintainer adds the ci:run label.
Taking a touch-paired finger's lift from its pointerup restores the release velocity and the long-press deadline when a slow pointerup listener delays WebKit's touchend, and the new WebKit tests fail without the change and pass with it. Two optional wording suggestions for the new source comments are inline.
[Automated review]
| * A paired finger's lift, at its `pointerup`: the place and clock its moves | ||
| * came on. Linux WebKit stamps the `touchend` that follows only after the | ||
| * page's pointerup listeners finish. A busy listener would then make a flick | ||
| * read as a resting finger. Read at the touchend, dropped with the finger. |
There was a problem hiding this comment.
Optional, comment style: "Read at the touchend, dropped with the finger." restates what onTouchEnd and forgetContact already show, in passive form. A version that keeps only the quirk:
/**
* A paired finger's lift, from its `pointerup`: the channel its moves come from.
* Linux WebKit stamps the `touchend` only after the page's pointerup listeners
* finish. A busy listener then makes a flick read as a resting finger.
*/| if (event.pointerType === 'touch' && this.usesTouchEvents) { | ||
| // The lift itself is the touchend's: it alone can cancel the click. | ||
| // The lift itself is the touchend's: it alone can cancel the click. Its | ||
| // place and time are this event's, where the finger's moves were read. |
There was a problem hiding this comment.
Optional, comment style: "where the finger's moves were read" is passive. For example:
// The lift itself is the touchend's: it alone can cancel the click. Its
// place and time come from this event, on the channel the finger's moves use.
User impact
In Linux WebKit, a slow pointerup listener breaks fast gestures. A flick releases at velocity 0, a pinch loses its speed, and a timely tap becomes a long press. Under CI load, page listeners held lifts 43–68 ms.
Problem and solution fit
Expected behavior and authority
spec:AST-100FR4: the velocity follows the input events' own timestamps, so a handler that runs late does not change it. FR2: only a still contact releases at 0. No record changes.Smallest restoration
GestureHost: a finger sampled from its pointer events lifts at its pointerup's place and time. The scroll brake's memory starts there too.Evidence
GestureHost. With a 50 ms pointerup listener in WebKit, a flick released 0, not 1,235–1,267 px/s. A pinch released 0, and the tap became a long press: 5 of 5 each.Scope
Testing
191 files, 3,965 tests passed. On the red arm, five units fail: the late lift, the tap against a long press, the brake's memory, the out-of-order list and the lift's place.
iOS 26.2 simulator (iPhone 17 Pro), Mobile Safari: real HID swipes through idb on the NavigationStack story, with and without a 60 ms pointerup listener. On the fixed build, the pointerup and the touchend had one timestamp in 6 of 6 runs. With the listener, the touchend reached the page 65–76 ms after that stamp. Every swipe ended as in 12 runs on main: idb's swipe rests 41–64 ms before it lifts, so none pops.
Core types check, and ESLint and Prettier are clean.