Skip to content

test(DateInput): the wheel pinch-zoom spec opens its minute wheel at a fixed time - #8332

Merged
cixzhang merged 1 commit into
meta:mainfrom
vjeux:uikit/c21-wheel-pinch-threshold
Oct 25, 2026
Merged

cixzhang merged 1 commit into
meta:mainfrom
vjeux:uikit/c21-wheel-pinch-threshold

Conversation

@vjeux

@vjeux vjeux commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer impact

The picker wheel pinch-zoom contract in pr-a11y fails in the last minutes of an hour, on PRs that don't touch the wheel. On #8123 (run 40137962720, job 121010245944) it expected scrollTop > 1656 and got 1652.

Intended invariant

The one-finger case proves that one finger still scrolls a picker wheel and leaves the page at scale 1 (WCAG 1.4.4); the pinch case beside it proves the zoom. Neither depends on the time of day.

Change

The spec's story has a bottom-sheet TimeInput with no value, so its Minute wheel opens on the current minute, and the minute list ends at 59. The one-finger case drags the wheel up 120 px and asserted that it scrolled more than 60 px. Its rows are 28 px, so from :57 the column can scroll only two rows before it reaches row 59: 57 × 28 = 1596 to 59 × 28 = 1652, the failure above. From :59 it can't scroll at all.

The spec now:

  • pins the clock to 10:30 before the story loads (page.clock.setFixedTime, in a beforeEach), so the wheel opens on :30 with rows to go;
  • polls scrollTop instead of sleeping 600 ms;
  • asks for at least one row, measured from the rendered option.

Only the spec changes.

Evidence

  • Failure before the change: the run above, which opened at :57. Reproduced locally by pinning the clock to 10:59: received 1652 against ≥ 1680.
  • Success after the change: with the clock at 10:30, both cases pass 16 of 16 in Chromium on the spec's phone profile (--repeat-each 8).
  • Product/runtime behavior verified unchanged: no source, story or style file changes.

Scope

  • No intended public API, product behavior, visual direction, or policy change.
  • Product changes discovered during the work were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

pnpm --filter ./apps/storybook build
ASTRYX_STORYBOOK_DIR=apps/storybook/dist pnpm exec playwright test \
  packages/core/src/DateInput/__tests__/WheelPinchZoom.a11y.chromium.spec.ts \
  --project chromium --repeat-each 8

16 passed (42 s). With the clock pinned to 10:59 instead, the one-finger case fails as on #8123.

@vercel

vercel Bot commented Oct 24, 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 25, 2026 12:22am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 25, 2026, 1:05 AM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 24, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more change is needed: the one-row bar is reasonable, but the one-finger case still depends on the clock, so the flake is not gone. The story's bottom-sheet TimeInput has no value, so the Minute wheel opens on the current minute and row 59 is the end of its scroll: the #8123 run started at :57 and stopped at that end (1596 → 1652), and a run that starts at :59 cannot scroll at all, so scrollTop >= before + row fails with 1652 against 1680. Please pin the clock before the story loads, for example await page.clock.setFixedTime(new Date(2026, 0, 1, 10, 30)) in a beforeEach (the Schedule time-grid spec pins its clock for the same reason), and reword the comment to name the start minute.

[Automated review]

.locator('[role="option"]')
.first()
.evaluate(el => el.getBoundingClientRect().height);
expect(await wheel.evaluate(el => el.scrollTop)).toBeGreaterThanOrEqual(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still fails whenever the story opens during minute :59. The story's bottom-sheet TimeInput has no value, so the Minute wheel starts on the current minute, and row 59 is its scroll end (scrollTop 1652): at :59 the drag cannot move it a row, and the assertion reports 1652 against >= 1680. The #8123 failure is the same end reached from :57 (1596 → 1652).

Pinning the clock before page.goto removes the dependence; the comment above can then name the start minute instead of a partial drag:

test.beforeEach(async ({page}) => {
  await page.clock.setFixedTime(new Date(2026, 0, 1, 10, 30));
});

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.

Right, that's the cause: the wheel opens on the current minute, and row 59 is the end of its scroll. Fixed in 9d5aee5:

  • a beforeEach pins the clock to 10:30 before the story loads;
  • scrollTop is polled instead of waiting 600 ms;
  • the comment names the start minute.

Pinning 10:59 instead reproduces the #8123 failure (1652 against ≥ 1680). At 10:30 both cases pass 16 of 16. The commit message and the description now give this root cause.

…a fixed time

The spec's story has a bottom-sheet TimeInput with no value, so its Minute
wheel opens on the current minute, and the minute list ends at 59. The
one-finger case drags the wheel up 120 px and asserted that it scrolled
more than 60 px, so a run in the last minutes of an hour failed: from :57
the column can scroll only two 28 px rows before it reaches row 59 (1596 to
1652, the pr-a11y failure on meta#8123), and from :59 none at all.

The spec now pins the clock to 10:30 before the story loads, polls
scrollTop instead of sleeping 600 ms, and asks for at least one row,
measured from the rendered option.
@vjeux
vjeux force-pushed the uikit/c21-wheel-pinch-threshold branch from 11cc210 to 9d5aee5 Compare October 25, 2026 00:13
@vjeux vjeux changed the title test(DateInput): the wheel pinch-zoom spec counts a one-finger scroll of any whole row test(DateInput): the wheel pinch-zoom spec opens its minute wheel at a fixed time Oct 25, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to merge: pinning the page clock to 10:30 before the story loads removes the time-of-day dependence that failed the one-finger case whenever it opened during the last three minutes of an hour, and the one-row bar still fails when one-finger panning is removed. No further changes are needed.

[Automated review]

@github-actions

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 3525 3525 -
Complexity Very High Very High (386) -

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

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

Status: No visual change across 2 compared shot(s).


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@cixzhang
cixzhang merged commit 3719fcf into meta:main Oct 25, 2026
64 checks passed
@vjeux
vjeux deleted the uikit/c21-wheel-pinch-threshold branch October 25, 2026 02:55

This branch was successfully deployed

1 active deployment
Preview — 9d5aee5c Deployed Oct 25, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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