You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 58a7ead
Browse filesBrowse the repository at this point in the historyBrowse files
feat(Slider): one touch model on every touch device
The maintainers ruled one touch model on every touch device, iOS and Android
alike, with no platform idiom (the touch resolver in meta#8062, now in meta#8076; AST-094
in meta#8316): touch behaviors key on a coarse primary pointer, and the resolver no
longer reports an idiom. The slider's touch presentation (the thumbs' touch
targets, UISlider's tracking and coast, the track's tap, the lift) now applies
under any finger; a mouse or a trackpad keeps the pointer handlers. The docs,
story and changeset say "under a finger" instead of "on iOS".
Tests: the Android cases that kept today's slider are flipped. The unit case
gives a coarse pointer with no iOS engine (no -webkit-touch-callout) the touch
targets and leaves a finger on the track to the touch presentation; it fails on
the previous head. The interaction cases run with no iOS-engine emulation, and
the Android case now checks the same model there: the lift, the travel past the
threshold and a track tap that sets the value on its lift (the Android Reduce
Motion case was the iOS one's duplicate and goes). The fine-pointer cases stay
as they were: no touch targets, and the desktop geometry case's pointer
styles.
Copy file name to clipboardExpand all lines: .changeset/slider-touch-tracking.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,5 +2,5 @@
2
2
'@astryxdesign/core': patch
3
3
---
4
4
5
-
[feat] Slider: on iOS the slider tracks a finger as UISlider does. Only the thumb takes a drag, through a 48 px target, so a swipe from the track scrolls the page; a tap on the track or a mark sets the value when the finger lifts, the thumb springing there (UISlider ignores track taps; a drag is not the only pointer way to set the value, WCAG 2.5.7). The value follows the finger’s travel past a 10 px threshold over the track’s length, so the thumb never jumps to the finger. A release coasts on UIKit’s spring before `onChangeEnd` reports. The coast runs on the compositor and keeps moving while the main thread is busy. A mouse, and every other touch screen (Android’s included), keeps the current behavior.
5
+
[feat] Slider: under a finger, on any touch device, the slider tracks as UISlider does. Only the thumb takes a drag, through a 48 px target, so a swipe from the track scrolls the page; a tap on the track or a mark sets the value when the finger lifts, the thumb springing there (UISlider ignores track taps; a drag is not the only pointer way to set the value, WCAG 2.5.7). The value follows the finger’s travel past a 10 px threshold over the track’s length, so the thumb never jumps to the finger. A release coasts on UIKit’s spring before `onChangeEnd` reports. The coast runs on the compositor and keeps moving while the main thread is busy. A mouse or a trackpad keeps the current behavior.
Copy file name to clipboardExpand all lines: apps/storybook/stories/Slider.stories.tsx
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -313,7 +313,7 @@ export const TouchTracking: Story = {
313
313
docs: {
314
314
description: {
315
315
story:
316
-
'On iOS only the thumb takes a drag, through a touch target larger than it; a swipe from the track scrolls the page, and a tap on the track sets the value when the finger lifts. The value follows the finger’s travel past a 10 px start threshold, so the thumb never jumps to the finger, and a release coasts on before `onChangeEnd` reports the value.',
316
+
'Under a finger only the thumb takes a drag, through a touch target larger than it; a swipe from the track scrolls the page, and a tap on the track sets the value when the finger lifts. The value follows the finger’s travel past a 10 px start threshold, so the thumb never jumps to the finger, and a release coasts on before `onChangeEnd` reports the value.',
Copy file name to clipboardExpand all lines: packages/core/src/Slider/Slider.doc.mjs
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -297,7 +297,7 @@ export const docs = {
297
297
],
298
298
anatomy,
299
299
description:
300
-
'A draggable control for selecting a numeric value or range within defined bounds. Supports single value and range selection, tick marks, custom value formatting, and vertical orientation. Use it when users need to explore a continuous range, such as volume, price, or percentage. On iOS it tracks a finger as UISlider does: only the thumb takes the finger, through a target larger than it, the value follows the finger’s travel rather than jumping to it, a release coasts on before `onChangeEnd`, a swipe from the track scrolls the page, and a tap on the track or a mark sets the value when the finger lifts (the thumb springs there). Other touch screens, Android’s included, keep the pointer behavior: a tap on the track moves the thumb there.',
300
+
'A draggable control for selecting a numeric value or range within defined bounds. Supports single value and range selection, tick marks, custom value formatting, and vertical orientation. Use it when users need to explore a continuous range, such as volume, price, or percentage. Under a finger, on any touch device, it tracks as UISlider does: only the thumb takes a drag, through a target larger than it, the value follows the finger’s travel rather than jumping to it, a release coasts on before `onChangeEnd`, a swipe from the track scrolls the page, and a tap on the track or a mark sets the value when the finger lifts (the thumb springs there). A mouse or a trackpad keeps the pointer behavior: a press on the track moves the thumb there.',
301
301
bestPractices: [
302
302
{
303
303
guidance: true,
@@ -510,7 +510,7 @@ export const docsZh = {
510
510
usage: {
511
511
anatomy,
512
512
description:
513
-
'A draggable control for selecting a numeric value or range within defined bounds. Supports single value and range selection, tick marks, custom value formatting, and vertical orientation. Use it when users need to explore a continuous range, such as volume, price, or percentage. On iOS it tracks a finger as UISlider does: only the thumb takes the finger, through a target larger than it, the value follows the finger’s travel rather than jumping to it, a release coasts on before `onChangeEnd`, a swipe from the track scrolls the page, and a tap on the track or a mark sets the value when the finger lifts (the thumb springs there). Other touch screens, Android’s included, keep the pointer behavior: a tap on the track moves the thumb there.',
513
+
'A draggable control for selecting a numeric value or range within defined bounds. Supports single value and range selection, tick marks, custom value formatting, and vertical orientation. Use it when users need to explore a continuous range, such as volume, price, or percentage. Under a finger, on any touch device, it tracks as UISlider does: only the thumb takes a drag, through a target larger than it, the value follows the finger’s travel rather than jumping to it, a release coasts on before `onChangeEnd`, a swipe from the track scrolls the page, and a tap on the track or a mark sets the value when the finger lifts (the thumb springs there). A mouse or a trackpad keeps the pointer behavior: a press on the track moves the thumb there.',
514
514
bestPractices: [
515
515
{
516
516
guidance: true,
@@ -546,7 +546,7 @@ export const docsDense = {
546
546
usage: {
547
547
anatomy,
548
548
description:
549
-
'A draggable control for selecting a numeric value or range within defined bounds. Supports single value and range selection, tick marks, custom value formatting, and vertical orientation. Use it when users need to explore a continuous range, such as volume, price, or percentage. On iOS it tracks a finger as UISlider does: only the thumb takes the finger, through a target larger than it, the value follows the finger’s travel rather than jumping to it, a release coasts on before `onChangeEnd`, a swipe from the track scrolls the page, and a tap on the track or a mark sets the value when the finger lifts (the thumb springs there). Other touch screens, Android’s included, keep the pointer behavior: a tap on the track moves the thumb there.',
549
+
'A draggable control for selecting a numeric value or range within defined bounds. Supports single value and range selection, tick marks, custom value formatting, and vertical orientation. Use it when users need to explore a continuous range, such as volume, price, or percentage. Under a finger, on any touch device, it tracks as UISlider does: only the thumb takes a drag, through a target larger than it, the value follows the finger’s travel rather than jumping to it, a release coasts on before `onChangeEnd`, a swipe from the track scrolls the page, and a tap on the track or a mark sets the value when the finger lifts (the thumb springs there). A mouse or a trackpad keeps the pointer behavior: a press on the track moves the thumb there.',
Copy file name to clipboardExpand all lines: packages/core/src/Slider/Slider.tsx
+7-10Lines changed: 7 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
/**
6
6
* @file Slider.tsx
7
7
* @input Uses React, useId, useRef, useCallback, useEffect, Field, useTooltip, VisuallyHidden; the touch presentation resolver and useSliderTouch (UISlider's touch tracking)
8
-
* @output Exports Slider and its props; unfilled marks share the track token; modifier-only key presses do not restore the thumb focus ring; a drag belongs to the pointer that started it; the thumbs and the filled range travel by `translate` from a progress custom property in container units of a box filling the control's padding box, so moving them never lays out (a value tooltip or text display still does) and padding on the control moves no part; the value tooltip anchors to a box layout places at the value; under a finger on iOS (the touch presentation's iOS idiom) only the thumbs' touch targets take touches, tracked as UISlider does, while a mouse and every other touch screen (Android's) keep the pointer handlers
8
+
* @output Exports Slider and its props; unfilled marks share the track token; modifier-only key presses do not restore the thumb focus ring; a drag belongs to the pointer that started it; the thumbs and the filled range travel by `translate` from a progress custom property in container units of a box filling the control's padding box, so moving them never lays out (a value tooltip or text display still does) and padding on the control moves no part; the value tooltip anchors to a box layout places at the value; under a finger (a coarse primary pointer, on every touch device) only the thumbs' touch targets take a drag, tracked as UISlider does, and a tap on the track sets the value on its lift, while a mouse or a trackpad keeps the pointer handlers
9
9
* @position Core implementation; consumed by index.ts, tested by Slider.test.tsx
10
10
*
11
11
* SYNC: When modified, update these files to stay in sync:
0 commit comments