Repository navigation
fix(DateInput, DateTimeInput): the sheet calendar's toggle and day tap under a finger #8206
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
base: main
Are you sure you want to change the base?
Changes from all commits
ae29720
202173c
a98a089
6c0e438
02efa8b
7b9acb3
d1767b9
fbeb9fc
72c72fd
7eb81b0
58d5558
7a027c2
00d9d68
3704441
9797905
0667de5
50ede6c
b2fd7b2
3450ca4
2ba4218
a702756
aa063df
cbdc64d
55aacf2
7027623
e784961
664ed1a
cb69fb2
6c7cecb
b1fb87b
a712d60
c6b74ea
d84ec6e
5911468
1baf567
feca481
74c78b7
4886ae5
e4c6e2b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| --- | ||
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] Under a finger, the calendar in the DateInput and DateTimeInput bottom sheets now pages its months like the iOS date picker: | ||
|
|
||
| - A swipe moves at most one month, chosen at the lift by iOS's paging rule: a quick flick, or a drag past half a month. It settles on iOS's paging curve. | ||
| - The month title follows the drag and the settle. It changes when the next month is more than half in view. | ||
| - An arrow scrolls one month. A second tap mid-scroll goes on to the month after. | ||
| - In the sheet, a drag is decided once it has moved 10 px either way. It pages the calendar if it has moved 10 px sideways by then, and moves the sheet otherwise. | ||
| - A horizontal trackpad swipe moves the calendar with it and pages at the release, like a drag. | ||
| - With Reduce Motion on, the arrows' step and a swipe's settle cross-fade in 200 ms instead of travelling. | ||
|
|
||
| With a mouse, the calendar still scrolls natively. With any pointer, PageUp and PageDown now move the keyboard focus by a month, and by a year with Shift. | ||
|
|
||
| @vjeux | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| --- | ||
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [feat] Under a finger, the calendar in the DateInput and DateTimeInput bottom sheets now toggles to its month and year wheels like the iOS date picker: | ||
|
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. Miss: these touch claims still have no Android emulator run at this head, and the description's iOS table (9–23 % of the fade lost before its first frame) contradicts the 54–82 % the newest commit measures here, with card 36's real-device result unstated. |
||
|
|
||
| - The month/year toggle cross-fades over `--duration-medium-min` (225 ms in the neutral theme, the token nearest iOS's 0.25 s there), where DateInput used a quick linear fade and DateTimeInput an instant swap. The wheels arrive on the theme's entrance curve and leave on its exit curve. As in UIKit, the header's month arrows and Reset and the footer's buttons take no tap during the fade, and a second tap on the title turns it around. | ||
| - The hidden month/year wheels are laid out once the sheet settles, so a toggle after that does not lay them out. | ||
| - The title's chevron points along the reading direction and turns a quarter turn to point down while the wheels show, on the theme's move curve. In DateInput it was a down chevron that flipped up; in DateTimeInput it was a down chevron that stayed still. | ||
| - A finger's tapped day takes its selection at once, with no colour transition. A mouse or pen pick keeps the fade, in the touch sheet too. | ||
|
|
||
| With a mouse or a pen, the toggle stays as it is. | ||
|
|
||
| When the title or Done toggles with keyboard focus in the outgoing panel, focus moves into the incoming one, with any pointer. In DateTimeInput, Done lands on the shown month's day. | ||
|
|
||
| With Reduce Motion on, nothing travels: under a finger the toggle cross-fades in 200 ms, and the chevron dips instead of turning, its turn landing mid-dip. With a mouse it changes at once. | ||
|
|
||
| @vjeux | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| --- | ||
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] Under a finger, the month and year wheels behind the calendar title in the DateInput and DateTimeInput bottom sheets now behave like the iOS date picker's: | ||
|
|
||
| - Turning a wheel moves a chosen date to the new month and keeps its day, so October 15 becomes May 15. A day the month lacks becomes its last day, the result stays within `min` and `max`, and DateTimeInput keeps the time. A date that `dateConstraints` refuses is not chosen; the calendar still moves. | ||
| - With no date chosen, the wheels only move the calendar. | ||
|
|
||
| With a mouse, the wheels still move only the calendar. | ||
|
|
||
| @vjeux |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| // Copyright (c) Meta Platforms, Inc. and affiliates. | ||
|
|
||
| /** | ||
| * @file MonthPagerProofs.stories.tsx | ||
| * @input Uses React and the internal MonthPager (packages/core/src/DateInput) | ||
| * @output The month pager alone, whatever the primary pointer: 2026 from | ||
| * March, its shown month in a read-only field | ||
| * @position A checked-in reproduction path for the trackpad proofs in | ||
| * packages/core/src/DateInput/__tests__/MonthPager.interaction.browser.spec.ts. | ||
| * WebKit's driver sends a trackpad's precise deltas only from a desktop | ||
| * context, where the sheets show the mouse calendar instead. | ||
| */ | ||
|
|
||
| import type {Meta, StoryObj} from '@storybook/react'; | ||
| import {useState} from 'react'; | ||
| import {MonthPager} from '../../../packages/core/src/DateInput/MonthPager'; | ||
| import { | ||
| createMonthModel, | ||
| fromMonthIndex, | ||
| toMonthIndex, | ||
| } from '../../../packages/core/src/DateInput/monthGeometry'; | ||
|
|
||
| const FIRST = toMonthIndex(2026, 1); | ||
| const LAST = toMonthIndex(2026, 12); | ||
| const MARCH = toMonthIndex(2026, 3); | ||
| const TODAY = {year: 2026, month: 3, day: 15}; | ||
| const GREGORY = createMonthModel('gregory'); | ||
|
|
||
| /** | ||
| * The readout takes the theme's text colour on the theme's surface, not the | ||
| * browser's white field. | ||
| */ | ||
| const READOUT_STYLE = {color: 'inherit', backgroundColor: 'transparent'}; | ||
|
|
||
| const meta = { | ||
| title: 'Core/MonthPager', | ||
| tags: ['no-visual', '!autodocs'], | ||
| parameters: {layout: 'centered'}, | ||
| } satisfies Meta; | ||
|
|
||
| export default meta; | ||
| type Story = StoryObj<typeof meta>; | ||
|
|
||
| /** The pager alone. Its field names the month it shows. */ | ||
| export const Pager: Story = { | ||
| render: () => { | ||
| const [shown, setShown] = useState(MARCH); | ||
| const {year, month} = fromMonthIndex(shown); | ||
| return ( | ||
| <div style={{display: 'grid', gap: 16, inlineSize: 360}}> | ||
| <input | ||
| aria-label="Shown month" | ||
| readOnly | ||
| style={READOUT_STYLE} | ||
| value={`${year}-${String(month).padStart(2, '0')}`} | ||
| /> | ||
| <MonthPager | ||
| monthModel={GREGORY} | ||
| minMonthIndex={FIRST} | ||
| maxMonthIndex={LAST} | ||
| initialMonthIndex={MARCH} | ||
| onVisibleMonthChange={setShown} | ||
| selectedDate={null} | ||
| today={TODAY} | ||
| isDateDisabled={() => false} | ||
| weekStartsOn={0} | ||
| onSelect={() => {}} | ||
| /> | ||
| </div> | ||
| ); | ||
| }, | ||
| }; |
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.
Miss: this tells consumers the touch calendar pages like the iOS date picker (one month per swipe, the 10 px sheet split, the trackpad pan), but the description shows no real-device iOS Safari evidence and no Android emulator run at this head.
spec:AST-094Platform support and DEC-27 ask for real-device evidence for every iOS Safari claim and, for Android Chrome, Chrome with Gboard in the Android emulator at the exact head, with animations at normal scale and removed, plus a slow-device profile.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.
Route: real-device iOS for this paging is card 35, carried (the specs comment on #8200), and Android is Code Quality at the final head. This changeset is #8200's: #8209 and #8200 merge first, then this pull request redeclares the three-PR stack, so until then its compare carries their files.