Skip to content

fix(Wheel): a wheel that stops outside the bounds rests on the nearest value inside them - #8131

Merged
cixzhang merged 1 commit into
meta:mainfrom
vjeux:uikit/c21-wheel-nearest-valid
Nov 3, 2026
Merged

cixzhang merged 1 commit into
meta:mainfrom
vjeux:uikit/c21-wheel-nearest-valid

Conversation

@vjeux

@vjeux vjeux commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Batch: B4 · Wheel / picker (DateInput, TimeInput, DateTimeInput)

User impact

On a phone, a bounded time picker makes people scroll twice: with min="09:00", flicking the hour wheel below 9 bounces back to 10. The iOS picker settles on 9, the nearest hour inside the bounds. The DateTimeInput and DateInput sheets behave the same.

Problem and solution fit

A wheel that stops on a disabled row goes back to the committed row (Wheel.tsx), forgetting which way the person was scrolling; bounds usually cut one end of a range, so this is common.

Options:

  • Go back to the committed row (today): simple, but the person scrolls again.
  • Stop the scroller at the bounds: never reaches a disabled row, but hides the greyed-out rows iOS shows and cuts the coast short.
  • Go on to the nearest enabled row (chosen): what UIDatePicker does, in the direction the person was already going, for one short extra turn.

That stop commits the row; stops on enabled rows are unchanged, and a mouse or trackpad rests the same way. A wheel whose value a bound changes (PM past the maximum) now turns there instead of jumping; under Reduce Motion, turns cross-fade.

Expected behavior and authority

component:DateInput FR13, FR14 and DEC-1 (cixzhang, 2026-10-25), as recorded; the TimeInput and DateTimeInput records name DateInput as the owner of the sheet wheels' rest and turn. This pull request closes FR13's and FR14's implementation and evidence gaps in the record, so an engineering owner's /approve-spec on its head approves that edit. Basis: UIDatePicker on the iOS 26.2 simulator, dragged from 10:00 to 7, settles on 9:00. design:reduced-motion DR2 and DR3 for the cross-fade.

Smallest restoration

Wheel.tsx's settle handler and scrollToIndex, an internal nearestEnabledIndex, a TimeInput story for the browser proof, and the record's FR13 and FR14 rows: their gap sentences and current-state lines go, and their verification rows cite the tests below. Size, gzip import against main e0548a6: DateInput, TimeInput and DateTimeInput +1.5 KB each, PowerSearch +0.7 KB; CSS unchanged.

Writing rubric results

Run over the record's changed lines (FR13 and FR14, their verification rows, Current-state impact, verified_by, design_specs):

  • R1 narration, R2 research, R3 pull requests as evidence: none.
  • R4 rejected alternatives, R5 change references, R6 open questions: none.

Evidence

main This PR
iOS: flicked below 9 Back to 10:00 Settles on 9:00
iOS: dragged onto 12 Back to 10:00 Settles on 11:00
Trackpad, Chromium, ¼ speed Back to 10:00 Settles on 9:00

Scope

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

On a phone or the iOS simulator, open Storybook's TimeInput › Bottom Sheet With Min Max (09:00–17:00):

  1. Flick the hour wheel down past 9. It settles on 9 and the field reads 9:00 AM; on main it returns to 10.
  2. At 10:00 AM, tap PM. The time clamps to 5:00 PM and the hour wheel turns to 5; on main it jumps.
  3. With Reduce Motion on, an arrow key on a wheel cross-fades the rows instead of gliding them (clip).

Automated: Wheel.test.tsx and the Chromium spec WheelRest cover each step and fail on main; a drag that comes back to rest on a committed value outside the bounds commits nothing.

Local gates at 1b84cdf: test:ui 729 files, 18,137 tests; test:node 859 files, 16,014 tests; strict lint, typecheck, check:knowledge and check:i18n-runtime; the Storybook build; Playwright in Chromium (a11y 79/79, interaction 7/7 on an exclusive 2-core pin) and in WebKit (CI's profile, --cpus=4, CI=1, 1 worker, ×10: 70/70).

@vercel

vercel Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 2, 2026 9:40pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 2, 2026, 9:57 PM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 24, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval waits on one owner decision and one fix. No current spec record says where a picker wheel should rest after stopping outside min/max (spec:AST-043 leaves wheel interaction to the components, and the DateInput and DateTimeInput records are still draft), so an engineering owner needs to decide whether the wheels adopt this nearest-in-bounds rule and record it by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner. Separately, the new branch in Wheel.tsx also runs on the settle that follows the wheel parking itself when the sheet opens, so opening a bounded TimeInput sheet on an out-of-range value (08:00 with min="09:00") or on an empty field commits a value and fires onChange with no touch; travelling only when the wheel rests away from its committed row fixes this, and a regression test for the open-time case should come with it.

[Automated review]

Comment thread packages/core/src/DateInput/Wheel.tsx Outdated
const option = options[index];
if (option == null || option.isDisabled) {
scrollToIndex(selectedIndex, 'smooth');
const restIndex = nearestEnabledIndex(options, index, selectedIndex);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This branch also runs on the settle that follows the park effect's programmatic scroll when the sheet opens (lines 371-373). When the committed row is disabled — a controlled value outside min/max, or an empty TimeInput whose clock-time starting point is outside them — the wheel travels and commits with no touch: 08:00 with min="09:00" becomes 09:00 and fires onChange. Travelling only when the wheel rests away from its committed row keeps that settle a no-op, as before:

const restIndex =
  index === selectedIndex
    ? index
    : nearestEnabledIndex(options, index, selectedIndex);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 81c13d9. A rest on the committed row is now left alone (index === selectedIndex ? index : nearestEnabledIndex(...)), so the park that follows opening a sheet on 08:00 with a 09:00 minimum commits nothing. New jsdom case "opening on a value outside the bounds parks on it without travelling or committing" fails before the change; a stop on another disabled row still travels to the bounds ("a stop on another disabled row still travels to the bounds").

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 1b84cdf

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
lab/MobilePowerSearch 166.5 kB (+1.5 kB) · 1.2 kB CSS (0) — — · — · —
DateInput · Storybook 100.7 kB (+1.5 kB) · 15.3 kB CSS (0) 3,757 (+108) ✓ · ✓ · ✓
DateTimeInput 112.7 kB (+1.5 kB) · 15.8 kB CSS (0) — — · — · —
2 more components
Component Size LoC Visual · A11y · RTL
TimeInput 88.0 kB (+1.5 kB) · 14.3 kB CSS (0) — — · — · —
PowerSearch 181.6 kB (+676 B) · 20.5 kB CSS (0) — — · — · —

Package size: @astryxdesign/core 5.82 MB packed (+3.7 kB); no new dependencies.

API changes: none in this pull request

Committed API report behind this build: core 18 rows; run pnpm api:report.

Touched components checked; add ci:run-visual, ci:run-a11y or ci:run-rtl to run the full suites.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval waits on one engineering-owner decision and one fix. No current spec record says where a picker wheel should rest after stopping outside min/max (spec:AST-043 leaves wheel interaction to the components, and the DateInput and DateTimeInput records are still draft), so an engineering owner needs to decide whether the wheels adopt this nearest-in-bounds rule and record it by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner. Separately, under reduced motion on a coarse pointer an arrow-key step now lands at once and then blinks the wheel for 200 ms, because the park effect repositions the wheel as soon as the step commits, before the cross-fade's midpoint; holding the park effect while a fade is pending (and using the last-touch check only for the post-drag travel) fixes it, and a real-browser reduced-motion test should come with it. The open-time commit from the previous revision is fixed.

[Automated review]

Comment thread packages/core/src/DateInput/Wheel.tsx Outdated
Comment on lines +358 to +364
scroller.animate([{opacity: 1}, {opacity: 0}, {opacity: 1}], {
duration: REDUCED_MOTION_FADE_MS,
easing: 'linear',
});
window.setTimeout(() => {
scroller.scrollTo({top, behavior: 'auto'});
}, REDUCED_MOTION_FADE_MS / 2);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under reduced motion on a coarse pointer, an arrow-key step reaches this branch and then moveBy calls onChange at once. The new value re-runs the park effect, which finds the wheel at rest off its committed row and scrolls there instantly, so the rows jump at full opacity and this dip plays afterwards over a wheel that has already landed. In Chromium with a coarse pointer the wheel lands 11 ms after the dip starts, at opacity 1, while a row tap and the post-drag travel land at the midpoint as intended. Holding the park effect while a dip is pending (or deferring the step's onChange to the midpoint) fixes it. Consulting lastPointerRef only for the settle's travel would also stop key steps from fading on a fine pointer after an earlier touch, where design:reduced-motion DR3 asks for an immediate change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 0797a16: the park effect holds while a dip has rows still to land, so a key step's rows land under it, and only the travel after a touch drag passes touchRelease. The cases are in Wheel.test.tsx and WheelRest.a11y.chromium.spec.ts, and the iOS 26.2 simulator measurement is in the description.

@vjeux
vjeux force-pushed the uikit/c21-wheel-nearest-valid branch from 81c13d9 to e70e8da Compare October 25, 2026 04:14
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Oct 25, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval waits on one engineering-owner decision, and the pull request needs changes either way. No current spec record says where a picker wheel should rest after stopping outside min/max (spec:AST-043 leaves wheel interaction to the components, and the DateInput and DateTimeInput records are still draft), so an engineering owner needs to decide whether the wheels adopt this nearest-in-bounds rule, recording it by commenting /approve-spec <full head SHA> on this pull request or by naming the record that should carry it; the author may do so as an engineering owner.

  • This revision carries all 94 commits of the open #8320 chain (34,603 authored lines for a 521-line fix, including module-level experimental subpaths that spec:AST-017 FR21 does not allow); rebase the wheel commit onto main with its own reduced-motion branch, or onto the landed dependency, so only the six wheel files remain.
  • Under reduced motion on a coarse pointer an arrow-key step lands at once and then blinks for 200 ms, because the park effect repositions the wheel before the cross-fade's midpoint; holding the park effect while a fade is pending, and passing touchRelease only for the post-drag travel, fixes it, ideally with a real-browser reduced-motion test.
  • spec:AST-017 FR59 asks touch work that changes mouse behavior to name its reason and show fine-pointer before-and-after evidence, and a mouse drag that stops outside the bounds now travels and commits too.

[Automated review]

Comment thread packages/core/src/DateInput/Wheel.tsx Outdated
[{opacity: 1, easing}, {opacity: 0, easing}, {opacity: 1}],
{duration, easing: 'linear'},
);
window.setTimeout(() => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under reduced motion on a coarse pointer, an arrow-key step reaches this branch and moveBy then calls onChange at once. The new value re-runs the park effect, which finds the wheel still at rest off its committed row and scrolls there instantly, so the rows jump at full opacity and this dip plays afterwards over a wheel that has already landed. Holding the park effect while a dip is pending (or deferring the step's onChange to the midpoint) fixes it. Passing touchRelease only from the settle's travel after a touch drag would also stop key steps from fading on a fine pointer after an earlier touch, where design:reduced-motion DR3 asks for an immediate change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 0797a16. The park effect now waits while a dip still has rows to land, and a further step retargets that dip instead of starting another, so the rows land under it. Only the travel that follows a touch drag passes touchRelease: a key step or a row tap follows the primary pointer, and a trackpad scroll clears the touch (DR2, DR3). Wheel.test.tsx adds the key step under the dip, a key and a tap after a touch on a fine pointer, the touch drag's travel and a trackpad scroll after a touch; three fail on the previous head. In Chromium on a phone profile the rows moved 252 to 280 px at opacity 1 before and land under the dip now (WheelRest.a11y.chromium.spec.ts); on the iOS 26.2 simulator with a hardware-keyboard arrow they moved at opacity 1.000 before and 0.005 now.

Comment thread packages/core/package.json Outdated
"types": "./dist/naming.d.ts",
"default": "./dist/naming.js"
},
"./motion/experimental": {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These module-level subpaths (and ./motion/reducedMotion.stylex below) come from the dependency chain, not the wheel fix. spec:AST-017 FR21 puts experimental hooks, functions and types on the owning component's /experimental subpath, and no component owns motion or gestures; #8076's description also says these subpaths are being dropped. Rebasing the wheel commit so this pull request carries only its six files keeps them out.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file comes from #8076, which this pull request carries because it is stacked on it; the change belongs there and reaches this pull request when its base does.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval waits on one engineering-owner decision, and the pull request needs changes either way. No current spec record says where a picker wheel should rest after stopping outside min/max (spec:AST-043 leaves wheel interaction to the components, and the DateInput and DateTimeInput records are still draft), so an engineering owner needs to decide whether the wheels adopt this nearest-in-bounds rule, recording it by commenting /approve-spec <full head SHA> on this pull request or by naming the record that should carry it; the author may do so as an engineering owner.

  • This revision carries the whole open #8320 chain (34,006 authored lines for a 521-line fix), so rebase the wheel commit onto main with its own reduced-motion handling, or onto the landed dependency, leaving only the six wheel files.
  • Under reduced motion an arrow-key step on a coarse pointer lands at once and then blinks for 200 ms, and after a touch key steps fade on a fine pointer; holding the park effect while a fade is pending and passing touchRelease only for the post-drag travel fixes both, ideally with a real-browser reduced-motion test.
  • spec:AST-017 FR59 asks for a named reason and fine-pointer before-and-after evidence now that a mouse drag stopping outside the bounds also travels and commits, and architecture:component-style-authoring INV6 asks for lazy loading or a justification of the 2.6–2.8 KB the four wheel hosts now grow.

[Automated review]

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval waits on one engineering-owner decision, and the pull request needs changes either way. No current spec record says where a picker wheel should rest after stopping outside min/max (spec:AST-043 leaves wheel interaction to the components, and the DateInput and DateTimeInput records are still draft), so an engineering owner needs to decide whether the wheels adopt this nearest-in-bounds rule, recording it by commenting /approve-spec <full head SHA> on this pull request or by naming the record that should carry it; the author may do so as an engineering owner.

  • This revision carries the whole open #8320 chain (36,498 authored lines for a 521-line fix), so rebase the wheel commit onto main with its own reduced-motion handling, or onto the landed chain, leaving only the six wheel files.
  • Under reduced motion an arrow-key step on a coarse pointer lands at once and then blinks for 200 ms, and after a touch key steps fade on a fine pointer (design:reduced-motion DR2 and DR3); holding the park effect while a fade is pending and passing touchRelease only for the post-drag travel fixes both, ideally with a real-browser reduced-motion test.
  • spec:AST-017 FR59 asks for a named reason and fine-pointer before-and-after evidence now that a mouse drag stopping outside the bounds also travels and commits.

[Automated review]

@cixzhang

Copy link
Copy Markdown
Contributor

Posted by Cindy's agent on her behalf.

Cindy's decision: match iOS. A picker wheel that comes to rest on a disabled row (outside min/max) continues to the nearest allowed row, with a tie going toward the current value, and selects it there, as UIDatePicker does. It no longer bounces back. Opening a bounded sheet must never change an untouched value: a controlled 08:00 stays 08:00, and an empty field stays empty. This head already does both.

No current record governs the rest rule, so it needs a home. Please add it to the wheel's owning record (component:DateInput and component:DateTimeInput, plus TimeInput's record, or the shared wheel record if there is one) as decided by cixzhang, 2026-10-25, so Cindy can approve that head. Also fix CodeBunny's remaining reduced-motion blink on keyboard steps.

vjeux, could you update the PR to match?

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval waits on an engineering owner's decision on the wheel's rest rule, which this pull request writes into the draft DateInput and DateTimeInput records (FR13, DEC-1, the Owns line and FR8): an engineering owner records it by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. Three changes are needed either way:

  • Under reduced motion, dragging a wheel with a mouse past a bound makes the rows jump back to the bound between mouse moves, because each drag step's scroll is treated as a rest; the travel should wait until the drag ends.
  • After a touch on a wheel, a later mouse drag still cross-fades its travel on a fine pointer instead of landing at once; recording the pointer with onPointerDownCapture in Wheel.tsx, with a test, fixes it.
  • The branch carries about 25,500 lines from other open pull requests, so rebasing onto main once they land would leave only the wheel's seven files.

[Automated review]

? index
: nearestEnabledIndex(options, index, selectedIndex);
if (restIndex !== index) {
scrollToIndex(restIndex, 'smooth', {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under reduced motion with a mouse, this travel also runs in the middle of a drag: usePointerDragScroll sets scrollTop on each move, Chromium reports each step as a finished scroll, and useScrollSettle counts it as rest, so the rows jump to the bound at once between moves (rows under the band 9, 8, 9, 8, 9, 7, … in Chromium, where the base shows 9, 8, 7, 6, 5). Skipping the settle travel while a mouse drag is held, and settling on its pointerup, would keep the content with the pointer.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed at 1b84cdf: the travel waits for a mouse drag's release. Wheel.test.tsx "waits for a mouse drag’s release before travelling back inside the bounds" covers it.

Comment thread packages/core/src/DateInput/Wheel.tsx Outdated
aria-activedescendant={`${id}-${options[activeIndex]?.value}`}
tabIndex={0}
onKeyDown={handleKeyDown}
onPointerDown={event => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This handler never sees a mouse press: usePointerDragScroll stops a primary mouse pointerdown on this element (usePointerDragScroll.ts:119) before React's root listener runs. After a touch, lastPointerRef stays 'touch' and a mouse drag's travel passes touchRelease: true, so under reduced motion on a fine pointer it cross-fades instead of landing at once (design:reduced-motion DR3). onPointerDownCapture runs first and keeps the pointer current; all 18 wheel tests still pass with it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed at 1b84cdf: the wheel records the pointer in the capture phase (onPointerDownCapture), before usePointerDragScroll stops a mouse press. Wheel.test.tsx "travels at once after a mouse drag that follows a touch, on a fine pointer" covers it.

vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval waits on an engineering owner's decision on the wheel's rest rule, which this pull request writes into the draft DateInput and DateTimeInput records (FR13, DEC-1, the Owns line and FR8): an engineering owner records it by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. Three changes are needed either way:

  • Under reduced motion, dragging a wheel with a mouse past a bound snaps the rows back to the bound whenever the pointer pauses, because each drag step's scroll is treated as a rest; the travel should wait until the drag ends.
  • After a touch on a wheel, a later mouse drag still cross-fades its travel on a fine pointer instead of landing at once; recording the pointer with onPointerDownCapture in Wheel.tsx, with a test, fixes it.
  • The branch carries about 25,600 lines from other open pull requests, so rebasing onto main once they land would leave only the wheel's seven files.

[Automated review]

? index
: nearestEnabledIndex(options, index, selectedIndex);
if (restIndex !== index) {
scrollToIndex(restIndex, 'smooth', {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under reduced motion with a mouse, this travel also runs in the middle of a held drag: usePointerDragScroll sets scrollTop on each move, Chromium fires scrollend after each step, and useScrollSettle treats it as rest, so the rows jump to the bound at once between moves (rows 8, 9, 8, 9 … 6, 9 under the band in Chromium, where the base shows 10, 9, 8, 7, 6). Skipping the settle travel while a mouse drag is held, and settling on its pointerup, keeps the content with the pointer, as design:reduced-motion asks of direct manipulation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b98c1d0, which merges #8483: the settle waits for a mouse drag's release, so the reduced-motion travel no longer runs while the button is down and the hand pauses. A test in Wheel.test.tsx covers it and fails on the previous head.

Comment thread packages/core/src/DateInput/Wheel.tsx Outdated
aria-activedescendant={`${id}-${options[activeIndex]?.value}`}
tabIndex={0}
onKeyDown={handleKeyDown}
onPointerDown={event => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This handler never sees a primary mouse press: usePointerDragScroll stops it in a native listener on this element (usePointerDragScroll.ts:119) before React's root listener runs. After a touch, lastPointerRef stays 'touch', so a mouse drag's travel passes touchRelease: true and cross-fades on a fine pointer under reduced motion, where design:reduced-motion DR3 asks for an immediate change. onPointerDownCapture runs first and keeps the pointer current; all 18 wheel tests still pass with it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b98c1d0: the wheel reads the pointer type in the capture phase (onPointerDownCapture), before usePointerDragScroll stops the press, so a mouse drag after a touch lands at once on a fine pointer. A test in Wheel.test.tsx covers it and fails without the fix.

vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval waits on an engineering owner's decision on the wheel's rest rule, which this pull request writes into the draft DateInput and DateTimeInput records (FR13, DEC-1, the Owns line and FR8): an engineering owner records it by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. That decision should also settle how the rule relates to the TimeInput record, which became current on 2026-10-27, owns the TimeInput sheet's wheels and is not amended here. Four changes are needed either way:

  • Under reduced motion, dragging a wheel with a mouse past a bound snaps the rows to the bound whenever the pointer pauses; the travel should wait until the drag ends.
  • After a touch on a wheel, a later mouse drag still cross-fades its travel on a fine pointer instead of landing at once; recording the pointer with onPointerDownCapture in Wheel.tsx, with a test, fixes it.
  • The new DateInput Owns line claims the wheels the TimeInput sheet renders, which the TimeInput record already owns; claiming only the shared wheel's mechanics keeps one owner.
  • The branch carries about 25,600 lines from other open pull requests, so rebasing onto main once they land would leave only the wheel's seven files.

[Automated review]

Comment on lines +90 to +91
- The bottom-sheet picker wheel (`Wheel`): its month and year wheels here, and the
wheels DateTimeInput and TimeInput render in their sheets.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line also claims "the wheels DateTimeInput and TimeInput render in their sheets", which component:TimeInput (current since 2026-10-27) already owns: "The native time control's integration and the bottom-sheet time wheels". That record hands only "wheel mechanics" to "the shared wheel used by the date and time inputs", so claiming the shared Wheel and its mechanics, its rest included, wherever it is rendered would leave each fact with one owner.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b98c1d0: the Owns line now claims the shared wheel's mechanics, how a sheet wheel rests, commits, steps and turns wherever it is rendered, plus DateInput's own month and year wheels. It says the time wheels in the TimeInput and DateTimeInput sheets belong to those records.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval waits on an engineering owner's decision about the wheel behavior this pull request adds: the rest rule written into the draft DateInput and DateTimeInput records (FR13, DEC-1, the Owns line and FR8), and the new turn onto a value changed from outside the wheel, which no record states yet even though the code cites DEC-1 for it. Once the turn is written into DEC-1 or FR13, or dropped, an engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request (the author may do so as an engineering owner), and the decision should also settle how the rule relates to the TimeInput record, which already owns the TimeInput sheet's wheels. Four changes are needed either way:

  • Under reduced motion, dragging a wheel with a mouse past a bound snaps the rows to the bound whenever the pointer pauses; the travel should wait until the drag ends.
  • After a touch on a wheel, a later mouse drag still cross-fades its travel on a fine pointer instead of landing at once; recording the pointer with onPointerDownCapture in Wheel.tsx, with a test, fixes it.
  • The new DateInput Owns line claims the wheels the TimeInput sheet renders, which the TimeInput record already owns; claiming only the shared wheel's mechanics keeps one owner.
  • The branch carries about 25,600 lines from other open pull requests, so rebasing onto main once they land would leave only the wheel's seven files.

[Automated review]

if (Math.round(scroller.scrollTop / size) !== selectedIndex) {
scroller.scrollTo({top: selectedIndex * size, behavior: 'auto'});
if (parkedRef.current) {
scrollToIndex(selectedIndex, 'smooth');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This turn onto a value changed from outside is new behavior with no record: component:DateInput DEC-1 (cited in the comment above, in Wheel.test.tsx:142 and in WheelRest.a11y.chromium.spec.ts:174) covers only where a wheel rests and that opening a sheet changes nothing, so an /approve-spec of this head would not cover it. If the engineering owners want it, write it into DEC-1 or FR13 before approval; otherwise keep the jump here and drop the DEC-1 citations.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b98c1d0: FR13 now says a shown wheel whose value changes from outside turns onto the new row rather than jumping to it, and DateTimeInput FR8 points at it. The code comment and both tests cite FR13 instead of DEC-1.

vjeux added a commit to vjeux/astryx that referenced this pull request Oct 29, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wheel's new rest works as described, but approval waits on an engineering owner's decision on the draft wheel requirements, recorded by commenting /approve-spec <full head SHA> on this pull request (the author may do this as an engineering owner). Two things to settle for that decision:

  • Whether component:DateInput FR13, DEC-1 and the Owns line, and component:DateTimeInput FR8, are the right home and wording for the wheel's rest and for the turn onto a clamped value.
  • FR13 and FR8 mark the turn "Settled by DEC-1", but DEC-1 records only the rest and opening a sheet, so the turn needs its own decision in DEC-1 or that citation should go.

Either way, please rebase once #8360, #8320, #8340 and #8076 land so the pull request carries only the wheel change, and correct .changeset/wheel-nearest-valid.md, which says key steps and taps cross-fade after a touch drag when only the travel does.

[Automated review]

| FR10 | Standalone mode MUST compose Field; admitted InputGroup mode MUST remove competing Field chrome while preserving name, description, value, keyboard, focus, and editing semantics. | `family:input-fields/FR3`; current source and InputGroup tests | Settled shared rule and verified adoption |
| FR11 | Clear MUST emit `undefined` through the ordinary change pipeline. The pointer and bottom-sheet surfaces restore field focus using their shipped timing; the native surface MUST NOT reclaim focus because doing so reopens the OS picker. Implementation gap: when the field becomes disabled or busy while its clear control holds focus, the control unmounts and focus falls to the document body; `spec:AST-085/FR4` requires focus to stay or move to a destination this record names. | Current source and focused clear tests; `spec:AST-085/FR4` | Verified shipped behavior |
| FR12 | No surface renders native `disabled`. A disabled field MUST stay focusable with `aria-disabled`, block typing, picking, clearing, and opening, describe its disabled reason when one is given, and take disabled paint. While busy (`isLoading` or a pending Action) the pointer and bottom-sheet surfaces expose `aria-disabled` and `aria-busy`, stay focusable, and block new commits; the native surface does the same for `isLoading`, and during a pending Action stays editable so the OS picker remains attached but rejects additional commits until the Action settles. A busy field that is not disabled keeps its ordinary paint and Spinner, shows no hover ring while commits are blocked, and keeps its keyboard focus ring. | `spec:AST-085/FR1–FR6`; `family:input-fields/FR4–FR6`; `family:buttons/FR4`; current source and focused tests | Settled shared rule and verified adoption |
| FR13 | A bottom-sheet picker wheel that comes to rest on a disabled row (outside `min`/`max`) MUST continue to the nearest enabled row, a tie going toward the committed row, and select it there. A wheel resting on its committed row MUST NOT select or commit, even when that row is outside the bounds, so opening a bounded sheet never changes an untouched value: a committed value outside the bounds stays, and an empty field stays empty. A shown wheel whose value changes from outside, as when a bound clamps the time after another wheel turned, MUST turn onto the new row rather than jump to it. | DEC-1; UIDatePicker on the iOS 26.2 simulator; wheel unit and real-browser tests | Settled by DEC-1 |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The third sentence (a shown wheel turns onto a value changed from outside) sits in a row marked "Settled by DEC-1", but DEC-1 below and the 2026-10-25 decision cover only the rest and opening an untouched sheet. Either add the turn to DEC-1 with whoever decides it, or keep it out of the "Settled by DEC-1" row until it is decided; DateTimeInput.spec.md FR8 repeats the same credit.

Comment thread .changeset/wheel-nearest-valid.md Outdated
'@astryxdesign/core': patch
---

[fix] A picker wheel that stops on a value outside the bounds now settles on the nearest value inside them. Before, it bounced back to the value it started from. This applies to the wheels in the TimeInput, DateTimeInput and DateInput bottom sheets. For example, with `min="09:00"`, dragging the hour wheel from 10 to 7 settles on 9, as the iOS time picker does. A stop on a value inside the bounds is unchanged. Opening a sheet on a value outside the bounds commits nothing. When a bound changes a wheel's value while the sheet is open, as when the meridiem wheel turns past the maximum, that wheel turns onto the new value instead of jumping there. Under reduced motion, the wheel's own scrolls (this travel, and the step from an arrow key or a click on a row) no longer glide: on a touch screen, or after a touch drag, they cross-fade, the rows landing while they are faded out; otherwise they land at once.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"on a touch screen, or after a touch drag, they cross-fade" also covers the arrow-key step and the row click here, but those cross-fade only on a coarse primary pointer (Wheel.tsx:548, :623 pass no touchRelease); after a touch drag on a fine pointer they change at once, as Wheel.test.tsx "changes at once after an earlier touch on a fine pointer, for a key or a tap" expects. Only the travel after a touch drag cross-fades on any pointer.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed at 1b84cdf: the changeset now says the arrow-key step and a click on a row cross-fade on a touch screen and land at once with a mouse or a trackpad; only the travel after a touch drag cross-fades on any screen.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval waits on an engineering owner's decision on the draft wheel requirements this pull request adds: component:DateInput FR13, DEC-1 and the Owns line, the new FR14 (a shown wheel turns onto a clamped value instead of jumping), and component:DateTimeInput FR8. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner; FR14 has no decision yet, so the approval or a requested change needs to cover it explicitly. Either way, please rebase once #8360, #8340 and #8076 land so the pull request carries only the wheel change, and correct .changeset/wheel-nearest-valid.md, which says key steps and taps cross-fade after a touch drag when only the travel does.

[Automated review]

Comment thread .changeset/wheel-nearest-valid.md Outdated
'@astryxdesign/core': patch
---

[fix] A picker wheel that stops on a value outside the bounds now settles on the nearest value inside them. Before, it bounced back to the value it started from. This applies to the wheels in the TimeInput, DateTimeInput and DateInput bottom sheets. For example, with `min="09:00"`, dragging the hour wheel from 10 to 7 settles on 9, as the iOS time picker does. A stop on a value inside the bounds is unchanged. Opening a sheet on a value outside the bounds commits nothing. When a bound changes a wheel's value while the sheet is open, as when the meridiem wheel turns past the maximum, that wheel turns onto the new value instead of jumping there. Under reduced motion, the wheel's own scrolls (this travel, and the step from an arrow key or a click on a row) no longer glide: on a touch screen, or after a touch drag, they cross-fade, the rows landing while they are faded out; otherwise they land at once.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also says the arrow-key step and a click on a row cross-fade "after a touch drag", but those cross-fade only on a coarse primary pointer: Wheel.tsx:548 and :623 call scrollToIndex with no touchRelease, and Wheel.test.tsx "changes at once after an earlier touch on a fine pointer, for a key or a tap" expects them to land at once. Only the travel after a touch drag cross-fades on any pointer.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed at 1b84cdf: the changeset now says the arrow-key step and a click on a row cross-fade on a touch screen and land at once with a mouse or a trackpad; only the travel after a touch drag cross-fades on any screen.

vjeux added a commit to vjeux/astryx that referenced this pull request Oct 30, 2026
…wheel-uikit-look

# Conflicts:
#	packages/core/src/DateInput/DateInput.spec.md
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 30, 2026
…R14 [skip ci]

meta#8131 made the turn its own requirement, DateInput FR14, pending owner
approval; the wheel's park note and its test said FR13.
…t value inside them

component:DateInput FR13 and DEC-1: a sheet wheel that comes to rest on a
disabled row (outside min/max) continues to the nearest enabled row, a
tie going toward the committed row, and commits it there. Before, it went
back to the committed row, so reaching the bound took another scroll. A
wheel resting on its committed row commits nothing, even outside the
bounds, so opening a bounded sheet never changes an untouched value.

FR14: a shown wheel whose value changes from outside, as when the
meridiem wheel turns past the maximum and the field clamps the time,
turns onto the new row instead of jumping there.

Under Reduce Motion the wheel's own scrolls no longer glide: on a touch
screen, or after a touch drag, they cross-fade; otherwise they land at
once (design:reduced-motion DR2, DR3).

The record's FR13 and FR14 lose their implementation gaps, their
verification rows cite these tests, and the two current-state lines go.

Red first: Wheel.test.tsx's rest and turn cases and
WheelRest.a11y.chromium.spec.ts fail on the previous wheel; the case for
a drag that comes back to rest on a committed value outside the bounds
fails when the committed-row guard is removed.
@vjeux
vjeux force-pushed the uikit/c21-wheel-nearest-valid branch from f116024 to 1b84cdf Compare November 2, 2026 21:27
@github-actions github-actions Bot added needs:spec-owner-review Current knowledge records await owner approval and removed needs:design-review Affects visuals — Design should review labels Nov 2, 2026
@cixzhang

cixzhang commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

/approve-spec 1b84cdf

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 2, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval recommended: the shared sheet wheel now rests on the nearest allowed value and turns onto clamped values as component:DateInput FR13 and FR14 require, and its reduced-motion forms follow design:reduced-motion DR2 and DR3. The new wheel tests fail against the previous wheel and pass on this head. CI was skipped while the pull request is a draft, so the required checks still need to run before merge. Three optional comment tidy-ups in Wheel.tsx are noted inline.

[Automated review]

Comment on lines +24 to +27
* Under Reduce Motion, the wheel's own scrolls (a step from a key or a click,
* the travel to the nearest enabled row) land without travel. They cross-fade
* on a touch screen and land at once otherwise. A finger's scroll and its
* momentum stay the platform's.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking (architecture:knowledge-contracts INV29): the file header is already 35 lines, and the same reduced-motion rule appears again on lastPointerRef and inside scrollToIndex. Keep one statement, at scrollToIndex, for example: "Under Reduce Motion this scroll fades on a coarse pointer or after a touch drag. Otherwise it lands at once."

Comment on lines +330 to +331
// trackpad's scroll cross-fades on a coarse primary pointer and lands at
// once on a fine one.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: a trackpad's own scroll is native and never fades; only the travel after it does. A shorter, accurate version: "What last started a scroll: a pointer type, or 'wheel' for a mouse wheel or trackpad."

// The running dip, so a step during its fade-in starts the next one where
// the column is.
const dipRef = useRef<Animation | null>(null);
useEffect(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: this Effect has no note saying what it releases (architecture:react-component-runtime INV3), for example: "Clear a landing timer that is still pending at unmount."

@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Nov 2, 2026
@cixzhang
cixzhang marked this pull request as ready for review November 2, 2026 22:37
@cixzhang
cixzhang merged commit 6658a4c into meta:main Nov 3, 2026
125 checks passed
@vjeux
vjeux deleted the uikit/c21-wheel-nearest-valid branch November 3, 2026 02:29

This branch was successfully deployed

1 active deployment
Preview — 1b84cdf0 Deployed Nov 2, 2026 by vercel[bot]
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants