Repository navigation
feat(Wheel): UIPickerView's motion under a finger, with flat rows #8159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+6,082
−287
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
52d8aad
feat(Wheel): UIPickerView's motion under a finger, with flat rows
vjeux 78b8bce
test(Wheel): judge a flick's coast by the velocity the page measured
vjeux 50a2ea5
feat(Wheel): a trackpad drives the touch wheel as a finger, and a not…
vjeux 2e3bbc4
refactor(Wheel): drop the turns from script and the owner's rest rule…
vjeux c615baa
fix(Wheel): attach the strip from a callback ref, and say what the sh…
vjeux 02f533e
fix(Wheel): a key moves to the next enabled row and stops at the last…
vjeux f154768
fix(Wheel): keys step through a wheel's values in time order, so 12 P…
vjeux 5461709
docs(Wheel): name the scrolling column instead of today's
vjeux e62c162
fix(Wheel): a key with nowhere to go leaves a turn in flight to finis…
vjeux f5a6493
fix(Wheel): the touch column's fade sits inside it, so its focus ring…
vjeux d2ad35c
spec(AST-094, DateInput): the picker wheel's snap rate is an FR4 impl…
vjeux 2c09be7
test(DateInput): the meridiem turn proof judges the frames the strip …
vjeux 8b4fc04
test(Wheel): the scrolling column's Reduce Motion dip lands on the fa…
vjeux 87b9b84
test(DateInput): the Reduce Motion step proof records frames until th…
vjeux f3b01a2
fix(Wheel): the wheel strip takes the motion animator's new name
vjeux 2c6622c
test(touch bundle): PowerSearch and Table are listed once
vjeux File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [chore] Internal: browser proofs for the touch picker wheel in Chromium and WebKit, which a finger gets on every engine. A flick coasts on UIKit's curve onto the row it projects and commits on arrival. A finger landing on a coasting wheel stops it, and it then eases onto the nearest row. A storyboard films a flick and its coast. In Chromium, the coast also keeps advancing every frame while the main thread is blocked, and does no Layout or Paint per frame. Under reduced motion, a flick still coasts as momentum with its rows flat, and a tap cross-fades onto its row, animating opacity alone for 200 ms or less. Opening the month and year wheels writes no element per year, and each year is drawn once. Under a mouse, a drag still scrolls today's column onto a row. | ||
|
|
||
| @vjeux |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] In the DateInput, TimeInput and DateTimeInput bottom sheets, a wheel's Arrow, Page, Home and End keys move through its enabled values in time order, skipping disabled ones, and stop at the first or last enabled value, with a mouse as with a finger. On a 12-hour hour wheel 12 PM comes before 1 PM, so ArrowDown from 12 PM moves to 1 PM, and a key past the last allowed hour commits nothing. | ||
|
|
||
| @vjeux |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [chore] Internal: the Wheel's two presentations, the scrolling column under a mouse and the picker wheel under a finger, share one listbox hook for their ids, ARIA attributes, Arrow, Page, Home and End keys, and row clicks. Each keeps where its moves start: the scrolling column steps from the row under its band, and the picker wheel from the row it is heading to. | ||
|
|
||
| @vjeux |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [feat] On a touch device with a trackpad or a mouse, such as a tablet with a keyboard, the picker wheels in the TimeInput, DateTimeInput and DateInput bottom sheets now take a trackpad's two-finger scroll as a finger: the rows follow the fingers, coast on at their lift, and rest on a row. One mouse-wheel notch turns a wheel one row, as an arrow key does, with no coast. Before, both moved the rows by each scroll's own distance, so a trackpad's momentum ran at the browser's rate and one notch moved several rows. A ctrl-scroll still zooms the page. | ||
|
|
||
| @vjeux |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [chore] Internal: UIPickerView's values measured on iOS 26.2 join the touch motion tables as internal constants: the row pitch, the picker's height and its rubber band, the coast's stop speed and velocity floor, the snap at rest, the tap spin and the selection tick. The pure math a wheel moves with comes with them. It projects the row a release rests on as UIScrollView sums its deceleration, coasts with the rate re-solved to stop on that row, snaps, bounces at an end, rubber-bands, and spins to a tapped row. It is checked against UIKit's recorded frames. Nothing public changes: none of it is exported from the package entry point, and themes do not set these values. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Non-blocking: the tap spin is registered as the internal motion role |
||
|
|
||
| @vjeux | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [feat] Under a coarse primary pointer, as on a phone or a tablet, the picker wheels in the TimeInput, DateTimeInput and DateInput bottom sheets now move like UIPickerView. Their rows keep the 28 px pitch and lie flat, fading toward the edges of the column in every browser; the scrolling column under a mouse tilts and fades its rows only where the browser supports scroll-driven animations, and shows a plain list elsewhere. The row under the band is in semibold accent text on its plate while the wheel rests and while a finger drags it; no row is marked while the wheel coasts, snaps or turns. A flick coasts at UIKit's deceleration onto the row UIKit's projection picks. A finger landing on a moving wheel stops it. A tap on a row turns it onto the band, and a value changed from outside while the sheet is open, as when a bound clamps the time, turns the wheel onto its row instead of jumping there. Past the first or last row, a drag rubber-bands and the wheel bounces back. As on iOS, the value commits when the wheel comes to rest, and the coast keeps running while the page's main thread is busy. Arrow keys and clicks on a row still commit at once. Under reduced motion a flick still coasts, as scrolling does; a tap, a key or a slow release cross-fades onto its row. `presentation="popover"` keeps the previous surface; no value keeps the native-scroll column under a finger. Each row that reaches the band ticks with a short vibration where the browser supports it, as on Android; iOS Safari has no vibration. Under a fine primary pointer, as with a mouse on a desktop, the wheels keep the scrolling column. | ||
|
|
||
| @vjeux |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| // Copyright (c) Meta Platforms, Inc. and affiliates. | ||
|
|
||
| /** | ||
| * @file WheelProofs.stories.tsx | ||
| * @input Uses React and the internal Wheel (packages/core/src/DateInput) | ||
| * @output The Wheel alone, for its browser proofs: a 60-row minute column at | ||
| * 00, its committed minute shown in a read-only field; and the touch column | ||
| * alone, whatever the primary pointer, for the trackpad proofs | ||
| * @position A checked-in reproduction path for | ||
| * packages/core/src/DateInput/__tests__/Wheel.interaction.browser.spec.ts. | ||
| * The proofs test the Wheel itself, so they open a column that stays a plain | ||
| * Wheel whatever rules the sheets that use it add (looping, bounds, a date | ||
| * that moves with the month). | ||
| */ | ||
|
|
||
| import type {Meta, StoryObj} from '@storybook/react'; | ||
| import {useState} from 'react'; | ||
| import {PickerWheel} from '../../../packages/core/src/DateInput/PickerWheel'; | ||
| import {Wheel} from '../../../packages/core/src/DateInput/Wheel'; | ||
|
|
||
| const MINUTES = Array.from({length: 60}, (_, minute) => ({ | ||
| value: minute, | ||
| label: String(minute).padStart(2, '0'), | ||
| })); | ||
|
|
||
| const meta = { | ||
| title: 'Core/Wheel', | ||
| tags: ['no-visual', '!autodocs'], | ||
| parameters: {layout: 'centered'}, | ||
| } satisfies Meta; | ||
|
|
||
| export default meta; | ||
| type Story = StoryObj<typeof meta>; | ||
|
|
||
| /** | ||
| * A finger gets the touch column, a mouse the scrolling column; either commits | ||
| * into the field above it. | ||
| */ | ||
| export const Minutes: Story = { | ||
| render: () => { | ||
| const [minute, setMinute] = useState(0); | ||
| return ( | ||
| <div style={{display: 'grid', gap: 16, inlineSize: 160}}> | ||
| <input | ||
| aria-label="Committed minute" | ||
| readOnly | ||
| value={String(minute).padStart(2, '0')} | ||
| /> | ||
| <Wheel | ||
| label="Minute" | ||
| options={MINUTES} | ||
| value={minute} | ||
| onChange={setMinute} | ||
| /> | ||
| </div> | ||
| ); | ||
| }, | ||
| }; | ||
|
|
||
| /** | ||
| * The touch column alone, whatever the primary pointer: WebKit's driver sends | ||
| * a trackpad's precise deltas only from a desktop context, whose primary | ||
| * pointer is fine, and its mobile emulation sends no wheel at all. | ||
| */ | ||
| export const TouchMinutes: Story = { | ||
| render: () => { | ||
| const [minute, setMinute] = useState(0); | ||
| return ( | ||
| <div style={{display: 'grid', gap: 16, inlineSize: 160}}> | ||
| <input | ||
| aria-label="Committed minute" | ||
| readOnly | ||
| value={String(minute).padStart(2, '0')} | ||
| /> | ||
| <PickerWheel | ||
| label="Minute" | ||
| options={MINUTES} | ||
| value={minute} | ||
| onChange={setMinute} | ||
| /> | ||
| </div> | ||
| ); | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking: the tap spin is no longer only an internal constant:
registerPickerTablemakes its duration the internal motion rolepicker.tapSpin.durationMs(FR14). Consider "…and the selection tick, with the tap spin's duration as an internal motion role".