Skip to content

fix(DateInput): the month scroller's arrows follow the reading direction and land on the real day - #7466

Merged
cixzhang merged 9 commits into
mainfrom
fix/monthscroller-keys
Oct 14, 2026
Merged

cixzhang merged 9 commits into
mainfrom
fix/monthscroller-keys

Conversation

@cixzhang

@cixzhang cixzhang commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Problem

In DateInput's touch calendar (the month scroller) a keyboard user on a right-to-left page pressed ArrowLeft and focus went to the previous day — against the way the grid reads. And a keyboard move across a pane edge could land on the dimmed, disabled copy of the target day that the neighbouring pane shows at its edge, where Enter and Space select nothing. component:DateInput AR8 (APG Grid adoption) requires the horizontal arrows to follow the reading direction and focus to land on the real day; the record named both as implementation gaps until this fix. (PageUp/PageDown paging is deferred to a separate PR; AR8 keeps that gap.)

Fix

MonthScroller.tsx: the forward/backward day keys are chosen from the provider direction (useDirection(), already read as isRTL for the scroll geometry), so under RTL ArrowLeft is forward. Day buttons that are spill copies carry data-outside, and the focus-restore query excludes them, so a cross-pane move focuses the real day in its own pane. Up/Down, Home/End and touch behaviour unchanged; Page keys unchanged (deferred).

Evidence

  • DateInputTouch.test.tsx: "follows the reading direction under RTL: ArrowLeft moves to the next day" (provider dir="rtl": ArrowLeft 10 → 11 March, ArrowRight back to 10) and "moves keyboard focus by date, across the month boundary", extended to assert the real April 1 in the April pane, not the dimmed spill copy. Red arm: with MonthScroller.tsx reverted to main both fail; with the fix the DateInput directory is green (315).
  • tsc and eslint clean.

Changeset

@astryxdesign/core patch [fix].

Scope (split 2026-10-13)

This PR ships two of the three month-scroller fixes: the horizontal arrows follow the reading direction under RTL, and every keyboard move lands on the real day in its own pane rather than the dimmed spill copy a neighbouring pane shows. PageUp/PageDown paging is held back for a separate PR pending a maintainer question; AR8 keeps its "PageUp/PageDown do not page by a month" gap.

Record

Per the fix-PR rule, this PR deletes from component:DateInput AR8 (now on main) the two gaps it closes — RTL arrows and the spill-copy focus — keeps the Page-key gap, and cites in the AR8 verification row "follows the reading direction under RTL: ArrowLeft moves to the next day" and "moves keyboard focus by date, across the month boundary" (extended to assert the real day, not the spill copy). ArrowUp, Home/End, Page and activation stay under the pending Grid contract.

Writing rubric results

R1 narration: none; AR8 stays present tense (the gap sentence is deleted, not rephrased as history).
R2 research: none in the record.
R3 evidence: the AR8 verification cell cites test titles, not this pull request.
R4 rejected alternatives: none added.
R5 change references: none.
R6 open questions: unchanged.

…ding direction and PageUp/PageDown page by a month

Under RTL ArrowLeft now moves to the next day and ArrowRight to the
previous, and PageUp/PageDown move the focused day by a month with the day
of the month kept where it exists (component:DateInput AR8, APG grid).
Red-armed tests in DateInputTouch.test.tsx.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 13, 2026
@astracat-bot

astracat-bot Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

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

@vercel

vercel Bot commented Oct 13, 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 14, 2026 1:03am UTC

Request Review

@github-actions

github-actions Bot commented Oct 13, 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
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 3459 -
Complexity N/A Very High (376) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.9KB 1.2KB

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

44 of 448 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Selector Indicator Space Bottom Sheet Narrow End RTL neutral light 754,077
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,188
Chat Full AI Chat probe light 238,081
Chat Full AI Chat probe dark 237,048
Markdown Default probe light 159,625
Markdown Default probe dark 158,986
Collapsible Dividers probe dark 66,445
Collapsible Dividers probe light 66,445
Chat Default neutral dark 33,205
Chat Default neutral light 32,876
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,406
Chat With Attachments probe dark 11,232
ProgressBar With Target Mark probe dark 7,895
ProgressBar With Target Mark probe light 7,895
TableRowExpansion Detail Panel neutral dark 5,150
TableRowExpansion Detail Panel neutral light 4,068

and 24 more.


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.

Approval is on hold until a maintainer provides or identifies the governing spec for the month scroller's keyboard model: no current record on main says the horizontal arrows follow the reading direction under RTL or that PageUp/PageDown move the focused day by a month with the day clamped, and the AR8 and AST-020 FR15 text this relies on is still in open #7464 and #7458. If the Page keys stay, they need a focus fix before merge:

  • After PageDown from March 10 or PageUp from April 10, focus lands on the dimmed spill copy of the target date in the previous month's grid, which is aria-disabled, so Enter or Space selects nothing; skipping spill days in the focus lookup in MonthScroller.tsx fixes this and the same existing arrow-key case.
  • The new tests check only data-date, which the spill copy shares, so they should also assert the focused day's grid (or that it is not aria-disabled) and include a Page case that targets a spill date.

[Automated review]

Comment on lines +680 to +687
case 'PageUp':
event.preventDefault();
moveFocusByMonths(date, -1);
break;
case 'PageDown':
event.preventDefault();
moveFocusByMonths(date, 1);
break;

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.

PageUp/PageDown reuse the focus effect further down (L703–711), which focuses the first [data-date] match in the scroller. Spill days carry the same data-date, so when the target is among the first days of a month, focus lands on the previous pane's aria-disabled copy (PageDown from Mar 10 → the March grid's copy of Apr 10; PageUp from Apr 10 → the February grid's copy of Mar 10), and Enter/Space then selects nothing. Skipping spill copies in that lookup (for example a data-outside marker and :not([data-outside])) fixes this and the same existing arrow-key case.

Comment on lines +1133 to +1136
fireEvent.keyDown(day, {key: 'ArrowLeft'});
expect(document.activeElement).toHaveAttribute('data-date', '2026-03-11');
fireEvent.keyDown(document.activeElement!, {key: 'ArrowRight'});
expect(document.activeElement).toHaveAttribute('data-date', '2026-03-10');

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.

These assertions pass even though focus ends on the February grid's aria-disabled spill copies of March 11 and March 10, because the copies share data-date. Asserting the focused element's grid (closest('[role="grid"]')) or that it is not aria-disabled, plus a Page case whose target is a spill date such as PageDown from March 10, would catch the focus defect.

…'s dimmed spill copy

A date can be mounted twice — in its own pane and as a disabled spill day at
the edge of the neighbour — and the focus lookup took the first match, so a
page or an arrow across the month edge could land on a copy Enter and Space
cannot select. Spill days carry data-outside and the lookup skips them. The
tests now assert the focused day's pane and that it is enabled, with a page
case onto a date the previous pane also shows.

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

Approval needs a maintainer to provide or identify current governing spec on main for the month scroller's RTL arrow mapping and PageUp/PageDown month paging: today they are stated only in component:DateInput AR8 in open #7464, which keeps that record a draft, resting on the FR15 rule in open #7458. The spill-copy focus fix in this revision is sound: keyboard focus now lands on the real day instead of a disabled spill copy, and the added grid assertions fail without it. One change is needed either way: the changeset says Up/Down and Home/End are unchanged, but the focus fix changes where they land too, and DateTimeInput's touch sheet renders the same scroller, so please describe the focus fix and name DateTimeInput there.

[Automated review]

'@astryxdesign/core': patch
---

[fix] `DateInput`'s touch calendar (the month scroller): under RTL the horizontal arrows now follow the reading direction — ArrowLeft moves to the next day and ArrowRight to the previous — and PageUp/PageDown move the focused day by a month, keeping the day of the month where it exists. Up/Down, Home/End, and the scroller's touch behavior are unchanged.

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.

This line no longer matches the change: skipping spill copies in the focus lookup also changes where Up/Down and Home/End put focus whenever the target day is also drawn as a dimmed spill day in the previous month's grid, and DateTimeInput's touch sheet renders the same scroller. Suggest describing the focus fix, naming DateTimeInput, and keeping only "touch behavior is unchanged", for example:

[fix] The touch calendar's month scroller in `DateInput` and `DateTimeInput`: keyboard focus now lands on the real day instead of a dimmed copy of it in the neighbouring month's grid, for every arrow, Home/End and Page key; under RTL the horizontal arrows follow the reading direction; and PageUp/PageDown move the focused day by a month, keeping the day of the month where it exists. Touch behavior is unchanged.

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

Approval is waiting on a maintainer: the RTL arrow mapping and PageUp/PageDown month paging need a current spec claim on main, and today they are stated only in the draft component:DateInput AR8 in open #7464, which rests on the FR15 rule in open #7458. Once a maintainer makes that record current, or names an existing current claim that states both behaviors, no other change is requested here: the spill-copy focus fix is sound and covered by tests that fail without it, and the changeset now describes it and names DateTimeInput.

[Automated review]

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 55ad2da

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 837b3e0

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

Approval is waiting on one maintainer decision about PageUp/PageDown month paging: it is stated only in component:DateInput AR8, that record is still authority: draft (the /approve-spec approves the record edit but does not make it current), and the current spec:AST-020 FR15 rule covers only the arrow keys and Home/End. A maintainer needs to provide that governing spec by making the Page-key adoption current on main (for example by approving component:DateInput, or AR8, as current), or decide the Page keys should not ship. The RTL arrow fix and the real-day focus fix match current spec and are covered by tests that fail without them, so nothing else here blocks approval.

[Automated review]

…key paging held back

The Page-key handling and its two tests move to a held local branch; AR8
keeps its PageUp/PageDown gap and cites only the shipped tests; the
Changeset describes what ships.
@cixzhang cixzhang changed the title fix(DateInput): month scroller arrows follow the reading direction; PageUp/PageDown page by a month fix(DateInput): the month scroller's arrows follow the reading direction and land on the real day Oct 14, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 35e4088

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

This looks ready to approve: under RTL the month scroller's horizontal arrows now follow the reading direction, and keyboard focus lands on the real, selectable day instead of a neighbouring month's dimmed copy, which matches the adopted grid keyboard model and is confirmed by tests that fail without the fix and by before/after browser runs. One small ask: the description's Problem, Fix and Evidence sections still describe PageUp/PageDown paging and a Page-key test that this revision no longer contains, so please refresh them before merge. As an optional follow-up, a key pressed while focus sits on a clicked spill day still moves focus into a month the calendar does not scroll to, because the scroller follows only when the starting day's month changes.

[Automated review]

@cixzhang
cixzhang merged commit 50cda00 into main Oct 14, 2026
90 of 92 checks passed
@github-actions
github-actions Bot deleted the fix/monthscroller-keys branch October 14, 2026 06:22

This branch was successfully deployed

1 active deployment
Preview — 35e4088a Deployed Oct 14, 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.

1 participant