Repository navigation
chore(core): a pager that pages like a UIKit paging scroll view - #8146
Merged
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Primary intent: an internal behavior module (the pager hook) for Carousel; no public API.
User need
Paging should feel like iOS: pages follow the finger, the lift picks UIKit's page, the settle survives a busy main thread; a mouse or trackpad pages it too.
Evidence
Simulator and emulator clips (iOS 26.2; P12: Android 15); Cindy checked the preview (#9364) on a phone and a trackpad, covering the two Mobile Safari behaviors the pager relies on (P7). Red ring: the finger.
goTo(3); mid-dragProblem and solution fit
pageForReleaseapplies chore(core): UIKit's paging values and math, measured on iOS 26.2 #8145's thresholds; a release moving back toward its start page stays there (FR37). The track settles on UIKit's integrator, on the compositor.goTorunssetContentOffset(_:animated:): it cancels a drag, keeps a running move's velocity (FR6), and reads its duration and curve throughresolveMotion(FR4; no role names them).pages: 'children': each child is a page at its start edge.setOptionsor controlledgoTocauses run next frame (INV2); a replaced viewport or track ends a drag on its start page.Current specification
spec:AST-094FR3–FR6, FR8–FR10, FR14, FR19, FR24, FR36–FR41, FR43, DEC-24, DEC-25;design:reduced-motionDR2, DR3;architecture:react-component-runtimeINV2, INV3, INV13.With the spec owners' text, FR6, DEC-25 and the FR6 pager row narrow #8145's gap: only a page change during a drag starts from rest. It needs a spec owner's
/approve-spec <head sha>.Public delta and caller burden
No behavior change:
useAttachment's users keep their lifecycle, and nothing renders the pager until #8153. The changeset is[chore].Design and alternatives
translate.Supersedes #8692: its trackpad swipe rules are in this commit.
Scope
Testing
settle:0:2,settle:2:7andsettle:2:1);goTowith no jump and the late backward spike; the viewport replaced mid-drag or before its report; a touch with the pan off;nearestPagebefore the first measure; the pan's neutral name; the viewport's own frames; INV2's deferred callbacks; FR6's retarget velocity (jsdom and both browsers); children pages, CSS zoom included; the 10 pt claim at 35° and 45°; FR41's selection lock; the controlled index; FR19 and FR43's every-pointer and trackpad cases (Chromium skips the trackpad ones: its CDP wheels lack a trackpad'swheelDelta); FR4'sresolveMotionread;useAttachmentPair's lifecycle (hooks/useAttachment.ts).armHold, armed before the input), and every release storyboard judges each frame against UIKit's curve for the lift velocity the pan read, within 1.5 px. Waits count from the input: a motion must start within 5 s of the input's end, and the retarget proof waits in its own task 100 ms into its 300 ms curve. A failed case's message starts with a load report.goTocross-fade (200 ms); fine non-touch releases land at once (FR43). Limit: in a block an unpainted page stays blank (sheet); owners layer nearby pages.usePager.test.ts123); the WebKit job's routing test (ci-interaction-webkit.test.mjs) 14 passed; the usePager browser proofs: Chromium on a pinned pair of 2 cores, 4 workers: 23 passed, 2 skipped; WebKit, the CI job's profile (podman--cpus=4,CI=1,LP_NUM_THREADS=4, 1 worker) ×10: 220 passed, 30 skipped. At c21b226d8b: check:i18n-runtime and check:i18n-catalog,lint:strict0 errors, the fullpnpm test:ui(first run 18,378 passed, 1 failed, 27 skipped; second 18,376 passed, 1 failed, 29 skipped; the reds are main's lazy-import waits, whose cause fix is test: module loads are awaited, not raced against test clocks #9447) and WebKit--cpus=3at 1 and 16 workers, 22 passed and 3 skipped each.githubfiles:git diff --stat eadd175390a18ba5c5ba7735e8a29e9c38ae6202...HEAD -- .githubis empty against main at eadd175. The WebKit interaction job's pager scope landed as ci: the WebKit interaction lane runs the pager's proof for the pager files #9377.useCarouselPaging.ts) is 1,446; the rest is the paging math's FR6 carry, the table's constants and registration,useAttachment's pair (+56 −14), the record's FR6 narrowing (+6 −8) and the changesetspec:AST-094FR4, FR6, FR19, FR37, FR41, FR43 and DEC-24;spec:AST-100FR2;spec:AST-107DEC-2 (a factory under the hook);design:reduced-motionDR2, DR3;architecture:react-component-runtimeINV2, INV3, INV13;architecture:knowledge-contractsINV29; and the global recordspnpm specs:for --difflists. No public API change. The owner-gated path isdocs/specs/AST-094-touch-presentations/spec.md;pnpm check:knowledgepasses.Writing rubric results
Run over the record text this PR changes in
spec:AST-094(the spec owners' wording, pasted as given):Rejected:line is unchanged.Stack: this PR, then #8153 (#8145, #8676 and #8360 have merged), one commit here, no merges.