Skip to content

fix(DateInput): a wheel commits at a mouse drag's release, not at every row it passes - #8483

Merged
cixzhang merged 1 commit into
meta:mainfrom
vjeux:uikit/c21-wheel-mouse-settle
Oct 31, 2026
Merged

cixzhang merged 1 commit into
meta:mainfrom
vjeux:uikit/c21-wheel-mouse-settle

Conversation

@vjeux

@vjeux vjeux commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • Why does it commit? The drag assigns scrollTop on every move, and Chromium ends each of those scrolls with its own scrollend: 14 moves, 14 scrollends. The settle (useScrollSettle) commits on scrollend.
  • Why doesn't the settle wait? It waits for a touch to end, and a mouse drag sends no touch events.
  • Why does it matter? It sets a value the person hasn't chosen yet; under a finger the same wheel commits only at the release.

Options:

  • Ignore scrollend after a scroll set from script. Narrow, but it depends on each browser's event order.
  • Commit at the release and skip the settle. Simple, but loses the glide onto the nearest row and the rest rule.
  • Chosen: the settle waits while a drag holds the wheel, as it waits for a finger, and the release starts it. One rule for both.

Expected behavior and authority

usePointerDragScroll lets a mouse drag the wheel "the way a finger does", and useScrollSettle states the finger's rule: "A finger resting mid-drag is not rest".

Smallest restoration

usePointerDragScroll exposes the drag state it already kept; useScrollSettle takes it and doesn't settle while it is true. MonthScroller is unchanged.

Evidence

Chromium, phone-sized, DateInput "Native picker modes", the adaptive-bottom-sheet field: a mouse drags the Month wheel two rows, March to May, and holds.

main This PR
Button still down (0, 400, 900 ms) May committed March kept
After the release May May

Held 400 ms: main (left) has committed May; this PR (right) keeps March

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

In Storybook, open DateInput › Native Picker Modes in a phone-sized window, with a mouse, and open the adaptive-bottom-sheet field:

  1. Drag the Month wheel two rows and hold the button: the month stays March. Release: May commits.
  2. Click a row: it commits at once. Scroll the wheel with the mouse wheel: it commits when it comes to rest. Both behave as on main.

Automated: the DateInputTouch.test.tsx case "commits nothing while a mouse drag holds the wheel, and commits at the release" fails on main.

Local gates at a77a79a: pnpm test:ui passes (653 files, 16,447 tests); pnpm test:node fails 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) and check:repo pass.

@vercel

vercel Bot commented Oct 26, 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 Oct 30, 2026 10:53pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 30, 2026, 11:50 PM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 26, 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.

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.
*/
/**

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.

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.

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.

Moved in c654597: the case now follows suspends snapping for the drag, and restores it after, with its own comment.

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

Modified Components

DateInput (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Entry File (ESM) 266B 266B 0B
Lines of Code 3532 3557 -
Complexity Very High Very High (390) -

Component Size

Component Import before Import after Delta CSS before CSS after Delta
core/DateInput 101.6KB 101.7KB +73B 15.0KB 15.0KB 0B
core/DateTimeInput 111.9KB 111.9KB +77B 15.4KB 15.4KB 0B
core/PowerSearch 168.3KB 168.4KB +96B 20.1KB 20.1KB 0B
core/TimeInput 88.8KB 88.9KB +58B 13.9KB 13.9KB 0B
lab/MobilePowerSearch N/A 155.3KB N/A N/A 1.2KB N/A

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 Summary

Gzip figures measure each package's entry file, not the code an import pulls in.

Package Entry (ESM) Entry gzip before Entry gzip after Delta
@astryxdesign/core 4.9KB 1.2KB 1.2KB 0B
Package stylesheet Gzip before Gzip after Delta
@astryxdesign/core 35.6KB 35.6KB 0B

Accessibility Audit

Status: The accessibility audit did not run on this pull request. It runs after merges to main and before each release; pull requests that touch components run it with the ci:heavy-lanes label.


Generated by PR Enrichment workflow | Storybook | Sandbox | 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.

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]

vjeux added a commit to vjeux/astryx that referenced this pull request Oct 29, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 29, 2026
…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.
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 29, 2026
…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.
@vjeux
vjeux marked this pull request as draft October 29, 2026 22:36
…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.

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

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]

@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Oct 31, 2026
@cixzhang
cixzhang marked this pull request as ready for review October 31, 2026 01:54
@cixzhang
cixzhang merged commit 802da1a into meta:main Oct 31, 2026
137 of 143 checks passed
@vjeux
vjeux deleted the uikit/c21-wheel-mouse-settle branch October 31, 2026 06:10

This branch was successfully deployed

1 active deployment
Preview — a77a79a6 Deployed Oct 30, 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