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 4d9e0cb
Browse filesBrowse the repository at this point in the historyBrowse files
fix(SegmentedControl): under Reduce Motion the selection fades and scales in at its new segment
UIKit's Reduce Motion substitution for the lens is not an instant move. When
the selection changes (a tap, a drag's lift, a programmatic set) the lens
jumps to the destination and fades and scales in place there: opacity from
0 and a uniform scale from 0.88 about its centre, on one clock and curve,
UIKit's 0.2 s block with Core Animation's default curve (F4's per-frame
read under Reduce Motion, Prefer Cross-Fade off and on: opacity and scale
share one progress at every frame; the 0.2 s curve-5 block fits all four
cases within 0.041, rms 0.012). The table entry segmentedControl.reducedMotion
carries the clock and curve as theme roles and the starting scale; the
controller plays the fade itself (the substitution is the motion), and the
titles still cross-fade. Tests sample the fade against the curve in jsdom,
Chromium and WebKit, and check the table against UIKit's frames.
Copy file name to clipboardExpand all lines: .changeset/segmented-control-selection-slide.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] SegmentedControl: on iPhone and iPad the selection slides to the new segment on UIKit's spring and the labels cross-fade, whether a tap, an arrow key or a new `value` moved it. The motion runs on the compositor and keeps moving while the main thread is busy; with Reduce Motion the selection moves without travel. The spring and the cross-fade are motion roles (`segmentedControl.*`) a theme can retune; UIKit's measured values are the default theme's. Other touch screens and desktops keep the color fade.
5
+
[feat] SegmentedControl: on iPhone and iPad the selection slides to the new segment on UIKit's spring and the labels cross-fade, whether a tap, an arrow key or a new `value` moved it. The motion runs on the compositor and keeps moving while the main thread is busy; with Reduce Motion it doesn't travel: it fades and scales in at the new segment, as iOS does. The spring, the cross-fade and the Reduce Motion fade are motion roles (`segmentedControl.*`) a theme can retune; UIKit's measured values are the default theme's. Other touch screens and desktops keep the color fade.
Copy file name to clipboardExpand all lines: apps/storybook/stories/SegmentedControl.stories.tsx
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -378,7 +378,7 @@ export const SelectionMotion: Story = {
378
378
docs: {
379
379
description: {
380
380
story:
381
-
'On iPhone and iPad the selection slides between segments on UIKit’s spring and the titles cross-fade, for taps, arrow keys and programmatic changes alike (the button changes the value from outside). Under Reduce Motion the selection moves without travel; other touch screens and desktops keep the color fade. Segments never change width when the selection moves.',
381
+
'On iPhone and iPad the selection slides between segments on UIKit’s spring and the titles cross-fade, for taps, arrow keys and programmatic changes alike (the button changes the value from outside). Under Reduce Motion the selection fades and scales in at the new segment instead; other touch screens and desktops keep the color fade. Segments never change width when the selection moves.',
Copy file name to clipboardExpand all lines: packages/core/src/SegmentedControl/SegmentedControl.doc.mjs
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -168,7 +168,7 @@ function WorkspaceCard() {
168
168
usage: {
169
169
anatomy,
170
170
description:
171
-
'A segmented button group that allows users to make a single selection from a small set of mutually exclusive options. Use SegmentedControl when all options should be visible at once and the selection controls a value or mode, not page navigation. On iPhone and iPad the selection slides to the new segment and the labels cross-fade, as in iOS, whether a tap, an arrow key or a new value moved it; with Reduce Motion it moves without travel. Other touch screens and desktops keep the color fade. A theme can retune the slide and the cross-fade through their motion roles.',
171
+
'A segmented button group that allows users to make a single selection from a small set of mutually exclusive options. Use SegmentedControl when all options should be visible at once and the selection controls a value or mode, not page navigation. On iPhone and iPad the selection slides to the new segment and the labels cross-fade, as in iOS, whether a tap, an arrow key or a new value moved it; with Reduce Motion it fades and scales in at the new segment instead of travelling. Other touch screens and desktops keep the color fade. A theme can retune the slide and the cross-fade through their motion roles.',
172
172
accessibility: [
173
173
{
174
174
name: 'Text label',
@@ -240,7 +240,7 @@ export const docsZh = {
240
240
usage: {
241
241
anatomy,
242
242
description:
243
-
'A segmented button group that allows users to make a single selection from a small set of mutually exclusive options. Use SegmentedControl when all options should be visible at once and the selection controls a value or mode, not page navigation. On iPhone and iPad the selection slides to the new segment and the labels cross-fade, as in iOS, whether a tap, an arrow key or a new value moved it; with Reduce Motion it moves without travel. Other touch screens and desktops keep the color fade. A theme can retune the slide and the cross-fade through their motion roles.',
243
+
'A segmented button group that allows users to make a single selection from a small set of mutually exclusive options. Use SegmentedControl when all options should be visible at once and the selection controls a value or mode, not page navigation. On iPhone and iPad the selection slides to the new segment and the labels cross-fade, as in iOS, whether a tap, an arrow key or a new value moved it; with Reduce Motion it fades and scales in at the new segment instead of travelling. Other touch screens and desktops keep the color fade. A theme can retune the slide and the cross-fade through their motion roles.',
244
244
bestPractices: [
245
245
{guidance: true,description: 'Use for switching between 2–5 mutually exclusive views or modes where all options should be visible.'},
246
246
{guidance: true,description: 'Provide a descriptive label for the control to ensure the group is accessible to screen readers.'},
@@ -256,7 +256,7 @@ export const docsDense = {
256
256
usage: {
257
257
anatomy,
258
258
description:
259
-
'A segmented button group that allows users to make a single selection from a small set of mutually exclusive options. Use SegmentedControl when all options should be visible at once and the selection controls a value or mode, not page navigation. On iPhone and iPad the selection slides to the new segment and the labels cross-fade, as in iOS, whether a tap, an arrow key or a new value moved it; with Reduce Motion it moves without travel. Other touch screens and desktops keep the color fade. A theme can retune the slide and the cross-fade through their motion roles.',
259
+
'A segmented button group that allows users to make a single selection from a small set of mutually exclusive options. Use SegmentedControl when all options should be visible at once and the selection controls a value or mode, not page navigation. On iPhone and iPad the selection slides to the new segment and the labels cross-fade, as in iOS, whether a tap, an arrow key or a new value moved it; with Reduce Motion it fades and scales in at the new segment instead of travelling. Other touch screens and desktops keep the color fade. A theme can retune the slide and the cross-fade through their motion roles.',
260
260
bestPractices: [
261
261
{guidance: true,description: 'Use for switching between 2–5 mutually exclusive views or modes where all options should be visible.'},
262
262
{guidance: true,description: 'Provide a descriptive label for the control to ensure the group is accessible to screen readers.'},
0 commit comments