Repository navigation
fix(DateInput): a wheel commits at a mouse drag's release, not at every row it passes - #8483
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Recommended for approval: a held mouse drag on the bottom-sheet picker wheels no longer commits the rows it passes, and the value now commits once at the release, as a finger's drag does. The new regression test fails before the fix and passes after it, and a click on a row, the scroll wheel and touch drags behave as before. One optional tidy-up: the new test sits between the scroll-snap-type comment and the snap-suspension test that comment documents, so moving it keeps that comment with its test.
[Automated review]
| * yanked back to a snap position, so the wheel stuck to a row and then | ||
| * jumped a whole one. | ||
| */ | ||
| /** |
There was a problem hiding this comment.
Nit: this test now sits between the scroll-snap-type comment just above and suspends snapping for the drag, and restores it after, the test that comment documents, so the snap rationale reads as if it belonged to this case. Moving this test (with its own comment) above that comment, or below the snap test, keeps each comment with its test.
There was a problem hiding this comment.
Moved in c654597: the case now follows suspends snapping for the drag, and restores it after, with its own comment.
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewModified ComponentsDateInput (@astryxdesign/core) · View in Storybook
Component Size
Sizes are gzip. Import counts the JavaScript the import loads eagerly; CSS counts the package stylesheet rules referenced by the modules it can load from its own package, lazily loaded ones included. Bundle Size SummaryGzip figures measure each package's entry file, not the code an import pulls in.
Accessibility AuditStatus: The accessibility audit did not run on this pull request. It runs after merges to Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
There was a problem hiding this comment.
Recommended for approval: a held mouse drag on the bottom-sheet picker wheels (TimeInput, DateTimeInput, DateInput) no longer commits the rows it passes, and the value now commits once at the release, as a finger's drag does. The new regression test fails before the fix and passes after it, and a click on a row, the scroll wheel and touch swipes commit exactly as before. The earlier note about the test's position is addressed, so nothing further is needed.
[Automated review]
…el-nearest-valid
…e turn - The wheel reads the pointer type on the way down. usePointerDragScroll stops a primary mouse press from bubbling, so after a touch a mouse drag's travel still cross-faded on a fine pointer under reduced motion. - With meta#8483 merged in, the travel waits for a mouse drag's release instead of running whenever the hand pauses; a test covers it here. - DateInput's Owns line claims the shared wheel's mechanics; the TimeInput and DateTimeInput records own their sheets' time wheels. - FR13 and DateTimeInput FR8 say a shown wheel turns onto a value changed from outside, which the code and its tests now cite.
…sheet on the desktop viewport This file's mouse cases run on a desktop viewport, where the field shows its popover unless it asks for the sheet; the case meta#8483 added now asks for it, as its neighbours do.
…ry row it passes usePointerDragScroll assigns scrollTop on every move, and Chromium ends each of those programmatic scrolls with its own scrollend: 14 moves, 14 of them. useScrollSettle settles on scrollend and waits only for a touch to end, so a mouse drag committed every row it passed with the button still down; in DateInput the calendar behind the month and year wheels changed under the hand. usePointerDragScroll now reports the drag it holds (isDraggingRef), and useScrollSettle takes it as it takes a finger still down: quiet is not rest while the drag holds the wheel, and the drag's pointerup re-arms the settle as touchend does. The glide to the nearest row re-arms it on its own, and the timer covers a release already on a row. Touch, keys and a click on a row are unchanged; MonthScroller's settle passes no drag and is unchanged. The new DateInputTouch case fails without the fix: the month commits to May while the drag still holds the wheel.
c654597 to
a77a79a
Compare
There was a problem hiding this comment.
Recommended for approval: a held mouse drag on the bottom-sheet picker wheels (TimeInput, DateTimeInput, DateInput) no longer commits the rows it passes, and the value now commits once at the release, as a finger's drag does. The new regression test fails before the fix and passes after it, and a click on a row, the scroll wheel and touch commit exactly as before. Nothing further is needed from the author.
[Automated review]
User impact
With a mouse, dragging a picker wheel in the TimeInput, DateTimeInput or DateInput bottom sheet committed every row it passed while the button was still down. In DateInput, the calendar behind the month and year wheels changed under the hand: dragging Month two rows, March to May, committed May before the release.
Problem and solution fit
What led to it: Astryx's UIKit-parity work lets a mouse drag the sheet wheels the way a finger does (
usePointerDragScroll), and testing the sheets with a mouse showed the drag committing early.scrollTopon every move, and Chromium ends each of those scrolls with its ownscrollend: 14 moves, 14scrollends. The settle (useScrollSettle) commits onscrollend.Options:
scrollendafter a scroll set from script. Narrow, but it depends on each browser's event order.Expected behavior and authority
usePointerDragScrolllets a mouse drag the wheel "the way a finger does", anduseScrollSettlestates the finger's rule: "A finger resting mid-drag is not rest".Smallest restoration
usePointerDragScrollexposes the drag state it already kept;useScrollSettletakes it and doesn't settle while it is true.MonthScrolleris unchanged.Evidence
Chromium, phone-sized, DateInput "Native picker modes", the
adaptive-bottom-sheetfield: a mouse drags the Month wheel two rows, March to May, and holds.Scope
Testing
In Storybook, open DateInput › Native Picker Modes in a phone-sized window, with a mouse, and open the
adaptive-bottom-sheetfield:main.Automated: the
DateInputTouch.test.tsxcase "commits nothing while a mouse drag holds the wheel, and commits at the release" fails onmain.Local gates at a77a79a:
pnpm test:uipasses (653 files, 16,447 tests);pnpm test:nodefails only on main's own story-tree cases (#8509) and release-cache cases (#8520); the Storybook build, the DateInput, TimeInput and DateTimeInput browser specs (75), root typecheck (no errors beyond main's) andcheck:repopass.