Skip to content

Commit 33c5a7d

Browse files
committed
feat(core): under a finger a selection mark changes in one frame
iOS has no checkbox or radio control; a choice is marked on its row, and on iOS 26.2 the mark changes in the frame the selection lands with no animation of its own: the checkmark accessory of a single-choice list in Settings, the completion circle in Reminders, a collection-view list's multiselect accessory, with and without Reduce Motion. CheckboxIndicator and RadioIndicator faded their box or circle between its two colors over the theme's fast duration under every pointer, so a tap showed half-filled frames first. Touch is one model on every touch device, so under a coarse primary pointer (the touch resolver's TOUCH_QUERY) the fade now takes the UIKit table's value, one frame (motion/uikit/selection.ts, mirrored for the stylesheet in Indicator/selectionMotion.stylex.ts and held to it by selectionMotion.test.ts). A mouse keeps the theme's duration and easing tokens; under Reduce Motion a mouse's change is immediate, in the instant key of the reduced-motion policy (design:reduced-motion DR3), and a finger's already is.
1 parent 1203525 commit 33c5a7d

10 files changed

Lines changed: 747 additions & 8 deletions
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@astryxdesign/core': patch
3+
---
4+
5+
[feat] Under a finger (a coarse primary pointer, on every touch device), a checkbox or radio mark now changes in the frame the selection lands, the way UIKit shows a selection mark. The box or circle used to fade between its two colors over the theme duration, so a tap first showed half-filled frames. With a mouse the marks keep the theme duration and easing, and under Reduce Motion a mouse's change is now immediate.
6+
7+
@vjeux

‎packages/core/src/Indicator/CheckboxIndicator.tsx‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
/**
44
* @file CheckboxIndicator.tsx
5-
* @input Indicator state props
5+
* @input Indicator state props; the mark-change clock of a touch presentation
6+
* (selectionMotion.stylex.ts, mirroring motion/uikit/selection.ts)
67
* @output Exports CheckboxIndicator — the default checkbox selection visual
78
* @position Decorative checkbox visual shared by CheckboxInput, CheckboxList,
89
* and decorative menu markers
@@ -18,8 +19,12 @@ import {
1819
} from '../theme/tokens.stylex';
1920
import {isRenderable, mergeProps, themeProps} from '../utils';
2021
import {indicatorScope} from './indicator.markers.stylex';
22+
import {selectionMotionConsts} from './selectionMotion.stylex';
2123
import type {IndicatorProps} from './types';
2224

25+
/** How long the mark takes to change under a finger: one frame. */
26+
const MARK_CHANGE = `${selectionMotionConsts.markChangeMs}ms`;
27+
2328
const styles = stylex.create({
2429
box: {
2530
boxSizing: 'border-box',
@@ -33,7 +38,14 @@ const styles = stylex.create({
3338
transitionProperty: 'background-color, border-color',
3439
transitionDuration: {
3540
default: durationVars['--duration-fast'],
36-
'@media (prefers-reduced-motion: reduce)': '0s',
41+
// Under a finger (a coarse primary pointer, the touch resolver's
42+
// TOUCH_QUERY) the mark changes in the frame the selection lands, as
43+
// UIKit's selection marks do (motion/uikit/selection.ts); a mouse keeps
44+
// the theme's duration. Under Reduce Motion a mouse's change is
45+
// immediate (design:reduced-motion DR3); a finger's already is.
46+
'@media (pointer: coarse)': MARK_CHANGE,
47+
'@media (prefers-reduced-motion: reduce) and (not (pointer: coarse))':
48+
'0s',
3749
},
3850
transitionTimingFunction: easeVars['--ease-standard'],
3951
},

‎packages/core/src/Indicator/Indicator.doc.mjs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const docs = {
2626
name: 'CheckboxIndicator',
2727
displayName: 'Checkbox Indicator',
2828
description:
29-
'The checkbox visual: a square box with a checkmark or an indeterminate bar. Decorative (aria-hidden); the owning control keeps the input, role, accessible name, focus, and keyboard behavior.',
29+
'The checkbox visual: a square box with a checkmark or an indeterminate bar. Decorative (aria-hidden); the owning control keeps the input, role, accessible name, focus, and keyboard behavior. Under a finger (a coarse primary pointer) the box changes in one frame, as UIKit selection marks do; with a mouse its colors fade over the theme duration.',
3030
props: [
3131
{
3232
name: 'state',
@@ -97,7 +97,7 @@ export const docs = {
9797
name: 'RadioIndicator',
9898
displayName: 'Radio Indicator',
9999
description:
100-
'The radio visual: a circle with a filled inner dot when selected. Draws in both states; an unselected radio is an empty circle, which is what lets it stand in for a checkmark in a selection slot.',
100+
'The radio visual: a circle with a filled inner dot when selected. Draws in both states; an unselected radio is an empty circle, which is what lets it stand in for a checkmark in a selection slot. Under a finger (a coarse primary pointer) the circle changes in one frame, as UIKit selection marks do; with a mouse its colors fade over the theme duration.',
101101
props: [
102102
{
103103
name: 'state',

‎packages/core/src/Indicator/RadioIndicator.tsx‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
/**
44
* @file RadioIndicator.tsx
5-
* @input Indicator state props
5+
* @input Indicator state props; the mark-change clock of a touch presentation
6+
* (selectionMotion.stylex.ts, mirroring motion/uikit/selection.ts)
67
* @output Exports RadioIndicator — the default radio selection visual
78
* @position Decorative radio visual shared by RadioList, decorative menu
89
* markers, and any selection slot themed to use a radio
@@ -18,8 +19,12 @@ import {
1819
} from '../theme/tokens.stylex';
1920
import {isRenderable, mergeProps, themeProps} from '../utils';
2021
import {indicatorScope} from './indicator.markers.stylex';
22+
import {selectionMotionConsts} from './selectionMotion.stylex';
2123
import type {IndicatorProps} from './types';
2224

25+
/** How long the mark takes to change under a finger: one frame. */
26+
const MARK_CHANGE = `${selectionMotionConsts.markChangeMs}ms`;
27+
2328
const styles = stylex.create({
2429
circle: {
2530
boxSizing: 'border-box',
@@ -37,7 +42,14 @@ const styles = stylex.create({
3742
transitionProperty: 'background-color, border-color',
3843
transitionDuration: {
3944
default: durationVars['--duration-fast'],
40-
'@media (prefers-reduced-motion: reduce)': '0s',
45+
// Under a finger (a coarse primary pointer, the touch resolver's
46+
// TOUCH_QUERY) the mark changes in the frame the selection lands, as
47+
// UIKit's selection marks do (motion/uikit/selection.ts); a mouse keeps
48+
// the theme's duration. Under Reduce Motion a mouse's change is
49+
// immediate (design:reduced-motion DR3); a finger's already is.
50+
'@media (pointer: coarse)': MARK_CHANGE,
51+
'@media (prefers-reduced-motion: reduce) and (not (pointer: coarse))':
52+
'0s',
4153
},
4254
transitionTimingFunction: easeVars['--ease-standard'],
4355
},

0 commit comments

Comments
 (0)