Skip to content

feat(Slider): every pointer drags a thumb by its travel, as UISlider does - #8190

Merged
cixzhang merged 9 commits into
meta:mainfrom
vjeux:uikit/c03-slider
Nov 2, 2026
Merged

cixzhang merged 9 commits into
meta:mainfrom
vjeux:uikit/c03-slider

Conversation

@vjeux

@vjeux vjeux commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Batch: Slider · finger tracking

Implements component:Slider FR7 (#9407): every pointer drags a thumb by its travel, as UISlider does. It supersedes #8189, #8669 and #8168, which close when it merges. It runs on main's harness.

Evidence

iOS 26.2 simulator, Android 15 emulator; the gray dot is a finger.

Before
After
Track tap
Hold
Reduce Motion
Release
Busy thread
List
Catch
Paths

User need

A Slider jumped its thumb to the pointer and trapped vertical swipes. UISlider moves the thumb by the travel and coasts after a flick.

Change

  • Every pointer: a press focuses the thumb and changes no value. Past 10 px the value follows the pointer's travel. A finger or a pen claims only along the track.
  • A finger: each thumb's ::before is a 48 px target. It lifts and drops on the sliderLift and sliderDrop roles, and a drag into an end plays UISlider's haptic where the browser vibrates. A flick coasts on springs.sliderRelease, with onChange through it and onChangeEnd when it settles. A finger on the coast stops it where it is drawn, and the coast follows the track's live length.
  • Taps: a finger's tap on the track sets the value on its lift, a mouse press at once.
  • Cancel: disabling mid-drag ends the drag with one onChangeEnd.
  • Reduce Motion: no lift, a tap applies at once, a flick still coasts.

Public delta and caller burden

No API change. A press no longer sets a value, a mouse drag starts after 10 px, and onChangeEnd follows a flick's coast.

Size

About +37 KB gzip, shipping as is; the live-length re-map reuses core's shared ResizeObserver. A follow-up loads the touch layer after hydration or on the first pointer. A single slider renders 14 elements (11 on main), a range 19 (16): a travel box for container units, a value anchor for the tooltip, and the fill's clip. The touch target adds none.

Design and alternatives

Keeping jump-to-pointer for a mouse was rejected: FR7 covers every pointer. #4050's resize mid-drag is handled: a drag and a coast follow the track's length. #7516's off-grid max is not addressed: with max 100 and step 3, a drag reaches 100 only past the end.

Current specification

component:Slider FR5–FR7, ORD2, DEC-4; spec:AST-094 FR4, FR9, FR13, FR19, FR23, FR42, FR43; spec:AST-017 FR60; design:reduced-motion DR2.

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.

Testing

Local gates at a610788: build, Storybook build, typecheck, strict lint (no warnings in changed files), check:knowledge, Slider's interaction specs in Chromium (23 passed) and WebKit (18 passed, 5 behind engine-limit guards), and the catch test ×80 at 4 workers on an exclusive 2-core pair (80 passed, no runner faults). Core and cli unit tests: 26,099 passed; 5 cli integration tests timed out at 30 s under machine load, and pass alone (211 of 211 in their three files), which this pull request does not touch. The provenance baseline check fails only on main's own four stale entries (ChatComposer, Item, layerSurfacePress, Token), which this pull request does not carry; its own entries match.

Red first: the focus case fails on the previous head for a finger and a pen; the disable-mid-drag case fails without the cancel; the zero-width case fails without the guard; a track tap that sets an end played the haptic before the pan check; two sliders made two observers before the shared one. On the previous stack, the catch's stop check failed 16 of 20 runs without the drawn-translate stop, and its visual check 20 of 20 without the live-length re-map.

The WebKit form of the busy-main-thread proof moves out of this pull request to a follow-up stacked on #9545, "Slider: the WebKit busy-main-thread proof on the paced touch play". On main's harness WebKit's injected touches bunch behind a stalled dispatch, and its JPEG cast moves in 2 px steps, so the proof cannot judge the coast there. Here the proof runs in Chromium, and its WebKit run carries the harness's engine-limit guard until the follow-up replaces it.

Writing rubric results

R1–R6 pass for every record edit: FR7's sentences, Slider's system specs, verification row and removed gap, AST-094's path list, the role table. No research, history or open questions.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) 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.

3 participants