Skip to content

feat(TimeInput): the minute wheel loops under a finger, as on iOS - #10953

Merged
cixzhang merged 6 commits into
meta:mainfrom
vjeux:feat/minute-wheel-loops
Nov 11, 2026
Merged

cixzhang merged 6 commits into
meta:mainfrom
vjeux:feat/minute-wheel-loops

Conversation

@vjeux

@vjeux vjeux commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

User need

On iOS, a time picker's minute wheel loops: past 59 comes 00, and the hour stays. Astryx's touch sheet stops at :59.

Problem and solution fit

  • The touch wheel gains an internal isLooping switch: its first row follows its last.
  • The minute wheels of TimeInput's and DateTimeInput's sheets turn it on. As in UIDatePicker, the seam keeps the hour.
  • The hour wheel does not loop yet: its AM/PM rule depends on the seam between 11 and 12.

Current specification

component:TimeInput FR7 and ORD3, component:DateInput FR17 and component:DateTimeInput FR14 now say passing the seam keeps the hour; FR7 scopes the loop to a coarse primary pointer. New component:DateInput DEC-3 records the decision. The motion table gains wheels.minuteSeamKeepsHour. wheels.meridiemFollowsHour drops a stale carry note. DateInput's Ownership boundary and spec:AST-094 name the loop helpers the wheel shares.

Public delta and caller burden

  • Under a finger, a drag, fling, tap or arrow key passes the seam; the hour stays. Home, End and a click never pass it.
  • Assistive technology still hears each minute once; the copies are hidden.
  • A mouse and the typed field stay as they are.

Design and alternatives

  • No loop: :59 dead-ends, unlike iOS.
  • Carry the hour at the seam: UIDatePicker does not, spinning or at rest.
  • Repeat the options in the listbox: a screen reader would hear each value repeatedly.
  • Chosen: copies only drawn. Each commit first moves the strip back to its rows.
  • The wheel takes nearestLoopCopy and mod from usePager, which the pager uses.

Evidence

  • UIDatePicker on the iOS 26.2 simulator: a flick from 2:30 PM through :59 rests on 2:05 PM. Safari's picker also keeps the hour.
  • The recorded case, re-run: the hour wheel takes 11:58 AM to 12:58 PM, then four minute rows read 12:02 PM.
  • Unit tests: a lap each way keeps the hour and AM/PM, from 11:59 AM, 11:59 PM, 12:00 PM and 1:00 PM.
  • Red-first: red arm 06ab7f9840, main's wheel, fails 29 of 248 tests.

Scope

Components: Wheel, TimeInput, DateTimeInput

Merges after #9810, #10284 and #8200, which import usePager, so this edit lands after their device checks. Its usePager hunk conflicts with #10592 and #10927; whichever merges second resolves it.

  • 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.
  • The DateInput, TimeInput and DateTimeInput records change in this PR.

Testing

Gates at e81a587b24, on main ebb9ddecc0.

  1. On a phone, open the preview's sandbox page, https://astryx-nfm1t27cb-fbopensource.vercel.app/sandbox/pages/minute-wheel-loop/, and tap the field: Astryx's wheels open at 11:58 AM.
  2. Flick the minute wheel up past :59, then back down past :00: it runs on, and the hour stays at 11 AM.
  3. pnpm exec vitest run --project ui packages/core/src/DateInput packages/core/src/TimeInput packages/core/src/DateTimeInput: 1219 tests pass.
  4. On the iOS 26.2 simulator in Safari, at 4aea43e16c, the sandbox page does the same: the clip. From 11:58 AM a fast flick up rests on 11:38 AM, and a flick back rests on 11:58 AM. The hour and AM never change. The recorder dropped frames for 0.15 to 0.25 s at a time, mostly as a swipe began, so the clip jumps there. None of the recording's 1,215 frames is blank. The two commits since change no behavior: the wheel takes the same two functions from usePager, and two records gain a line. A run at this head is pending.
    One sighting was not reproduced. On one of two iOS 26.2 simulators at b8c835418d, the first fast flick after the page loaded blanked the minute column mid-coast. The blank lasted 47 frames, about 0.8 s. Over seven fast flicks there, only those 47 of 4,863 frames were blank. A first flick on the other simulator was clean. Main's wheel, the same flick: 0 of 679 frames blank.
  5. Red-first for the rest a whole lap away: red arm 4594d5cba1 carries this head's two new tests on b8c835418d's wheel and fails both.

Public and internal API delta

  • Public: none. The generated surface compare for @astryxdesign/core, merge base ebb9ddecc0 against this head, has 0 added, changed or removed rows.
  • Internal, reached by no public entry point:
    • hooks/usePager.ts exports its existing mod, and the wheel imports mod and nearestLoopCopy from it. Usage: import {mod, nearestLoopCopy} from '../hooks/usePager'. Why: usePager already exports nearestLoopCopy, so no new module is needed. spec:AST-094 names both as shared.
    • WheelProps.isLooping?: boolean, an option of the internal Wheel. Usage: <Wheel options={minutes} value={58} onChange={setMinute} isLooping />. Why: TimeWheels turns it on for the minute column. It is off by default, and the mouse column ignores it.
    • WheelLayout.looping?: boolean. Usage: offsetBounds({rowHeight: 28, rowCount: 60, looping: true}) // {min: -Infinity, max: Infinity}. Why: a loop has no ends to rubber-band.
    • restingLoopStep and loopedStep in DateInput/wheelOptions.ts. Usage: restingLoopStep(p => p % 12 < 2, 11, 1, 12) // 1 and loopedStep(() => true, 59, 1, 60) // 1. Why: a rest and a key step find the nearest enabled row around the seam. DateInput's Ownership boundary names them.
    • The UIKit motion table gains datePicker.wheels.minuteSeamKeepsHour: true. Usage: datePicker.wheels.minuteSeamKeepsHour // true. Why: it records the measured iOS behavior that the time wheels follow.
  • App size: the whole sandbox app's built JS against main ebb9ddecc0, with chunk hashes normalized: +1,007 B gzip (+3,227 B raw). Nearly all of it, +979 B gzip, is in the chunk that holds the wheel. A fresh rebuild of the same code is byte-identical.
  • Size: +1420/−139 lines (ebb9ddecc0..e81a587b24), in 21 files: source +617/−104, tests +743/−1, docs and changeset +60/−34.

Writing rubric results

  • R1: DEC-3 quotes the decider's words verbatim, at the spec owners' explicit ask. Every other changed sentence states what the system does, in the present tense.
  • R2: no research enters the records; the UIDatePicker measurement stays in its motion table.
  • R3: evidence cells name tests and the UIKit measurement, not a change.
  • R4: DEC-3 holds its one rejected alternative on one Rejected: line.
  • R5: no pull request or issue number appears in the records.
  • R6: no open question is touched.

@vercel

vercel Bot commented Nov 10, 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 11, 2026 8:29am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 10, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 10, 2026
@astracat-bot

astracat-bot Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 11, 2026, 8:45 AM UTC

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · e81a587

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
DateTimeInput · Storybook 213.3 kB (+1.2 kB) · 18.7 kB CSS (0) 3,612 (0) ✗ · ✓ · ✓
DateInput · Storybook 191.1 kB (+1.2 kB) · 17.1 kB CSS (0) 6,035 (+271) ✗ · ✓ · ✓
PowerSearch 294.7 kB (+1.2 kB) · 24.2 kB CSS (0) — — · — · —
4 more components
Component Size LoC Visual · A11y · RTL
TimeInput · Storybook 165.9 kB (+1.1 kB) · 16.1 kB CSS (0) 1,609 (+1) ✓ · ✓ · —
Lightbox 124.7 kB (0) · 10.6 kB CSS (0) — — · — · —
lab/Comments 356.0 kB (0) · 2.5 kB CSS (0) — — · — · —
lab/CommentThread 349.1 kB (0) · 2.4 kB CSS (0) — — · — · —
Visual changes: 14 snapshots in 2 components

A change is a question for the reviewer, not a failure.

Component · story Before After Diff
DateInput · All Variations (neutral, light) before frame after frame diff frame
DateInput · All Variations (neutral, dark) before frame after frame diff frame
DateInput · Open Calendar Audit (neutral, light) before frame after frame diff frame
DateInput · Open Calendar Audit (neutral, dark) before frame after frame diff frame
DateInput · Open Calendar Audit (probe, dark) before frame after frame diff frame
DateInput · Open Calendar Audit (probe, light) before frame after frame diff frame
DateInput · Cleared Calendar Selection (neutral, light) before frame after frame diff frame
DateInput · Default (neutral, light) before frame after frame diff frame
DateTimeInput · Cleared Calendar Selection (neutral, light) before frame after frame diff frame
DateTimeInput · Default (neutral, light) before frame after frame diff frame
DateInput · Cleared Calendar Selection (neutral, dark) before frame after frame diff frame
DateInput · Default (neutral, dark) before frame after frame diff frame

2 more are in the run's visual report.

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

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 an engineering owner's decision about the record changes. This pull request writes the looping minute wheel, its one-hour-per-lap carry and the key change into the current component:TimeInput FR7 and ORD3, component:DateInput FR17 and component:DateTimeInput FR14. An engineering owner records that decision by commenting /approve-spec <full head SHA>, and the author may do so as an engineering owner. The decision should also settle whether a DateTimeInput carry at midnight keeps the date.

Blocking findings, to fix whatever the decision:

  • With min or max inside the shown hour, the copies, the rest rule and the key step judge the neighbouring hour's minutes by the shown hour's rows (PickerWheel.tsx:333-336, wheelOptions.ts:180, wheelOptions.ts:275-276), so at a 5 PM maximum the allowed 4:56–4:59 PM show greyed, and ArrowUp at 1:00 PM with a 1:30 PM maximum commits 12:30 PM.
  • A key carry past a bound leaves the minute wheel on the wrong row, because turnToPosition commits before it starts its own turn and that turn replaces the clamp's corrective spin (PickerWheel.tsx:828-830): PageDown at 4:55 PM with a 5 PM maximum commits 5:00 PM while the wheel rests on :05, and the test "brings a carry past the maximum back onto it" checks only aria-activedescendant.
  • nearestPosition, loopStep and wrapIndex re-implement nearestLoopCopy and mod from hooks/usePager.ts with a different tie rule, so they should move to one shared helper that both the pager and the wheel call.

CI has not run on this draft head yet.

[Automated review]

@vjeux
vjeux force-pushed the feat/minute-wheel-loops branch from adf627e to 32e4d64 Compare November 10, 2026 16:38
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 10, 2026
Under a finger, the bottom sheet's minute wheel now loops, as
UIDatePicker's does: past 59 comes 00, and the hour stays. On the
iOS 26.2 simulator a flick of UIDatePicker's minute wheel through 59
keeps its hour, so the datePicker motion table now says so. The
picker wheel gains an internal isLooping switch. Every commit first
moves the strip onto the wheel's own rows, so a value the owner
clamps turns the wheel on from there. The pager and the wheel share
one loop helper. A sandbox page shows the sheet at 11:58 AM. The
hour wheel does not loop yet.

@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 record changes. This pull request writes the looping minute wheel, which keeps the hour at the seam, into the current component:TimeInput FR7 and ORD3, component:DateInput FR17 and DEC-3, and component:DateTimeInput FR14. An engineering owner records that decision by commenting /approve-spec <full head SHA> on the pull request, and the author may do so as an engineering owner.

Blocking findings to fix, whatever the decision:

  • The description still says the minute wheel "carries the hour" (12:58 PM reading 1:02 PM, 11 AM turning to 12 PM), while the head, its tests and the changeset keep the hour, so the summary, evidence and testing steps need to describe the head's behaviour.
  • The proposed FR7 sentence "The minute wheel loops" names no pointer, but under a fine pointer the sheet renders the scrolling column, which stops at :59 (Wheel.tsx:287), so scope it to a coarse primary pointer as DEC-3 and the changeset do, or make the scrolling column loop too.
  • hooks/usePager.ts:272 keeps its own mod beside the new shared utils/loopIndex.ts mod, so import it from the shared helper and delete the local copy.

[Automated review]

Comment thread packages/core/src/utils/loopIndex.ts Resolved
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec fb0a4f3

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 11, 2026
@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Nov 11, 2026
@vjeux
vjeux marked this pull request as ready for review November 11, 2026 04:56
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec fb0a4f3

@vjeux
vjeux marked this pull request as draft November 11, 2026 04:58
FR7 now says the minute wheel loops under a coarse primary pointer, as
the rest of the record does. The pager imports mod from the shared loop
helper instead of keeping its own copy, and the wheel physics drop
stale wrap comments.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 11, 2026
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec b8c8354

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 11, 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.

Changes requested: the looping minute wheel's record text is approved at this head, and one wheel defect needs a fix.

Blocking:

  • Miss: a looping wheel treats a rest one lap from its committed row as a different row (PickerWheel.tsx:504), so at 10:05 AM with a 10:10 AM minimum a full turn back onto :05 commits 10:10 AM, and with no enabled minute in the hour a fling spins back more than two laps, against component:DateInput FR13; compare rows with mod(position, count), pass the nearest copy of the committed row (nearestLoopCopy) to restingLoopStep as its tie-break and fallback, and add a test for each case.

Non-blocking: two new comments in PickerWheel.tsx (lines 248 and 478) restate the code and can go.

Automated review (maintainer link)

The looping wheel compared its rest with the committed row by position,
so a rest whole laps away counted as another row. A full turn back onto
a committed value outside the bounds then committed the nearest enabled
row, and with no enabled row the wheel turned back over every lap. The
committed row now counts at its copy nearest the rest. Two comments
that restated the code go.
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 4aea43e

@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.

Approved pending CI: CI has not run on this head yet, because the pull request is still a draft.

The earlier blocker is fixed: a looping minute wheel that comes to rest a whole lap away on its committed row now commits nothing, even when that row is outside the bounds (component:DateInput FR13), and two new tests in PickerWheel.test.tsx cover it. The record text for the looping minute wheel (component:TimeInput FR7 and ORD3, component:DateInput FR17 and DEC-3, component:DateTimeInput FR14) is approved at this head, and no public API changes.

Automated review (maintainer link)

The looping wheel and the pager shared mod and nearestLoopCopy through
a new utils/loopIndex.ts module. usePager already exports
nearestLoopCopy, and its own mod is the same function. The wheel now
imports both from usePager, which exports mod, and the new module and
its test go.
AST-094 names usePager's mod and nearestLoopCopy, which DateInput's
looping picker wheel imports. DateInput's record names restingLoopStep
and loopedStep, the loop steps that wheelOptions.ts exports.
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 11, 2026
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec e81a587

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 11, 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.

Approved pending CI: CI has not run on this head yet, because the pull request is still a draft; it carries ci:run, so CI runs once it is marked ready.

The record text for the looping minute wheel (component:TimeInput FR7 and ORD3, component:DateInput FR17 and DEC-3, component:DateTimeInput FR14, and the spec:AST-094 line naming the shared loop helpers) is approved at this head. The tests for the loop, the rest and key rules across the seam, and the hidden copies pass, and no public API changes. One non-blocking suggestion is inline: two comments in PickerWheel.tsx retell the functions below them.

Automated review (maintainer link)

Comment on lines +317 to +318
// Draws the copies over `next`, or none. It adds the positions it lacks and
// drops those past the span. `isRedrawn` draws every copy again.

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.

Miss, non-blocking (architecture:knowledge-contracts INV29): this comment retells drawCopies step by step, and the one at line 364 retells cover. The reason, that the copies are drawn directly so a gesture never re-renders the wheel, is already stated above copiesRef at line 282. Both comments can go.

@vjeux
vjeux marked this pull request as ready for review November 11, 2026 08:59
@cixzhang

Copy link
Copy Markdown
Contributor

Decision: D-20261111-237

@cixzhang

Copy link
Copy Markdown
Contributor

Decision: D-20261111-242

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec e81a587

@cixzhang

Copy link
Copy Markdown
Contributor

Decision: D-20261111-242

@cixzhang
cixzhang merged commit f27380a into meta:main Nov 11, 2026
132 checks passed
@vjeux
vjeux deleted the feat/minute-wheel-loops branch November 11, 2026 10:27

This branch was successfully deployed

1 active deployment
Preview — e81a587b Deployed Nov 11, 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. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants