Repository navigation
fix(DateInput): the month scroller's arrows follow the reading direction and land on the real day - #7466
Conversation
…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.
|
AI review status for this pull request.
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewModified ComponentsDateInput (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Visual Regression44 of 448 shot(s) changed. A change here is a question, not a failure: check whether the after is the
and 24 more. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
There was a problem hiding this comment.
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 inMonthScroller.tsxfixes 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 notaria-disabled) and include a Page case that targets a spill date.
[Automated review]
| case 'PageUp': | ||
| event.preventDefault(); | ||
| moveFocusByMonths(date, -1); | ||
| break; | ||
| case 'PageDown': | ||
| event.preventDefault(); | ||
| moveFocusByMonths(date, 1); | ||
| break; |
There was a problem hiding this comment.
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.
| 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'); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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]
|
/approve-spec 55ad2da |
|
/approve-spec 837b3e0 |
There was a problem hiding this comment.
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.
|
/approve-spec 35e4088 |
There was a problem hiding this comment.
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]
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:DateInputAR8 (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 asisRTLfor the scroll geometry), so under RTL ArrowLeft is forward. Day buttons that are spill copies carrydata-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" (providerdir="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: withMonthScroller.tsxreverted to main both fail; with the fix the DateInput directory is green (315).Changeset
@astryxdesign/corepatch[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:DateInputAR8 (now onmain) 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.