Repository navigation
fix(Calendar): Shift+Page Up and Shift+Page Down move by a year - #9609
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Calendar · Storybook | 54.7 kB (+32 B) · 10.4 kB CSS (0) | 1,655 (+9) | ✓ · ✓ · ✓ |
| DateRangeInput | 72.1 kB (+32 B) · 11.9 kB CSS (0) | — | — · — · — |
| DateInput | 106.0 kB (+27 B) · 15.4 kB CSS (0) | — | — · — · — |
9 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| DateTimeInput | 162.6 kB (+26 B) · 17.1 kB CSS (0) | — | — · — · — |
| PowerSearch | 194.3 kB (+19 B) · 21.6 kB CSS (0) | — | — · — · — |
| lab/ChatEmojiPicker | 66.9 kB (new) · 773 B CSS (new) | — | — · — · — |
| lab/ChatReactionBar | 67.4 kB (new) · 1.1 kB CSS (new) | — | — · — · — |
| lab/CommentComposer | 105.5 kB (new) · 1.9 kB CSS (new) | — | — · — · — |
| lab/Comments | 259.2 kB (new) · 2.5 kB CSS (new) | — | — · — · — |
| lab/CommentThread | 254.1 kB (new) · 2.4 kB CSS (new) | — | — · — · — |
| lab/EmojiPicker | 71.2 kB (new) · 722 B CSS (new) | — | — · — · — |
| lab/MobilePowerSearch | 218.8 kB (new) · 1.2 kB CSS (new) | — | — · — · — |
Package size: measured; main has no measurement of the merge base to compare yet.
API changes: core +0 · ~2 · −0
Committed API report behind this build: core 2 rows; run pnpm api:report.
2 API changes (advisory)
| Package | Where | Signature | Usage | |
|---|---|---|---|---|
| ~ | core |
. · Types · interface UseGridFocusOptions |
onPageDown?: () => void → onPageDown?: (event: React.KeyboardEvent) => void |
import type {UseGridFocusOptions} from '@astryxdesign/core'; const x: UseGridFocusOptions = {onPageDown: …} |
| ~ | core |
. · Types · interface UseGridFocusOptions |
onPageUp?: () => void → onPageUp?: (event: React.KeyboardEvent) => void |
import type {UseGridFocusOptions} from '@astryxdesign/core'; const x: UseGridFocusOptions = {onPageUp: …} |
Touched components checked; add ci:run-visual, ci:run-a11y or ci:run-rtl to run the full suites.
Current run: CI concluded cancelled; parts of this report may be missing.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
The Shift+Page Up and Shift+Page Down year step works as described: the five new tests fail without the change and pass with it, and plain Page Up and Page Down still move a month. Approval waits on one spec decision, because the change intentionally amends the Calendar accessibility contract (AR1), which today names only Page Up and Page Down moving by a month: an engineering owner needs to approve or reject the Shift+Page year step as a named exception, including the February 29 to February 28 clamp. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. Two optional source-comment tidy-ups are noted inline.
[Automated review]
| // A page targets the same day of the month a month or a year away, | ||
| // clamped to that month's length. Past `min`/`max` nothing moves; a | ||
| // month with no enabled day is no destination either, the same as an | ||
| // arrow with no enabled day in its direction; a target disabled by a | ||
| // constraint lands on that month's first enabled day instead. |
There was a problem hiding this comment.
Optional: the second sentence runs 42 words over three topics and restates the inRange and firstEnabledDayOfMonth lines below. A shorter version that keeps only the reason:
// A page or a year step keeps the day of the month and clamps it to the
// target month's length. A month with no enabled day is no target, the same
// as for an arrow.| ); | ||
|
|
||
| // Handle PageUp/PageDown | ||
| // PageUp/PageDown move by a month. useGridFocus calls these without the |
There was a problem hiding this comment.
Optional: "PageUp/PageDown move by a month." restates the 'months' argument below; the next sentence, the useGridFocus constraint, is the part worth keeping.
There was a problem hiding this comment.
The Shift+Page Up and Shift+Page Down year step works as described: the five new tests fail without the change and pass with it, in the browser Shift+Page Down moves January 15, 2026 to January 15, 2027, and plain Page Up and Page Down still move a month. Approval waits on one spec decision, because the change intentionally amends the Calendar accessibility contract (AR1), which today names only Page Up and Page Down moving by a month: an engineering owner needs to approve or reject the Shift+Page year step as a named exception, including the February 29 to February 28 clamp. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. Nothing else needs to change; as a small note, the description's two-month line holds only for Shift+Page Down, since Shift+Page Up makes the target month the first one shown.
[Automated review]
There was a problem hiding this comment.
The Shift+Page Up and Shift+Page Down year step works as described: the six new tests fail without the change and pass with it, and in the browser Shift+Page Down moves January 15, 2026 to January 15, 2027 while plain Page Down still moves a month. Approval waits on two owner decisions: the change intentionally amends the Calendar accessibility contract (AR1), which today names only Page Up and Page Down moving by a month, so an engineering owner needs to approve or reject the Shift+Page year step as a named exception, including the February 29 to February 28 clamp, by commenting /approve-spec <full head SHA> on this pull request (the author may do so as an engineering owner); and an owner needs to accept, split or remove the new event parameter on the public useGridFocus onPageUp and onPageDown options, which no current spec covers. Separately, the description's claim that a two-month view shows the target month last holds only for Shift+Page Down, since Shift+Page Up shows it first.
[Automated review]
| // PageUp/PageDown move by a month, and with Shift by a year (APG date | ||
| // picker dialog). |
There was a problem hiding this comment.
Optional: this restates the e.shiftKey ? 'years' : 'months' argument below. Keeping only the reason:
// The APG date picker dialog gives Shift+Page to the year.|
|
||
| [fix] Calendar: Shift+Page Up and Shift+Page Down now move the focused day to the same date one year earlier or later, as in the WAI-ARIA date picker pattern, instead of one month. A February 29 lands on February 28 in a year without one. The year step follows the same rules as Page Up and Page Down: it changes nothing past `min` or `max`, and on a day that `dateConstraints` disables it focuses that month's first enabled day. | ||
|
|
||
| `useGridFocus` now passes the key event to `onPageUp` and `onPageDown`, so a grid can read `event.shiftKey`; callbacks that take no argument keep working. |
There was a problem hiding this comment.
Optional: if the useGridFocus event parameter stays, it is a compatible capability rather than a fix, so this sentence fits a separate [feat] changeset.
|
/approve-spec 627d80e |
There was a problem hiding this comment.
Ready to merge. Shift+Page Up and Shift+Page Down now move Calendar's focused day by a year, the component:Calendar AR1 exception carries an engineering owner's approval for this head, and the useGridFocus event argument was accepted with it. The six new tests fail without the source change and pass with it, and plain Page Up and Page Down still move a month.
Two optional follow-ups, neither blocking:
- The comment above
handlePageUpinCalendar.tsxrestates thee.shiftKey ? 'years' : 'months'argument; keeping only the reason (the APG date picker dialog gives Shift+Page to the year) is enough. - The
useGridFocusevent argument is a compatible capability, so it fits a separate[feat]changeset.
[Automated review]
There was a problem hiding this comment.
Ready to merge. Shift+Page Up and Shift+Page Down now move Calendar's focused day by a year, the component:Calendar AR1 exception carries an engineering owner's approval at this head, and the useGridFocus event argument was accepted with it. The six new tests fail without the source change and pass with it, and plain Page Up and Page Down still move a month.
Two optional follow-ups, neither blocking:
- The comment above
handlePageUpinCalendar.tsxrestates thee.shiftKey ? 'years' : 'months'argument; keeping only the reason (the APG date picker dialog gives Shift+Page to the year) is enough. - The
useGridFocusevent argument is a compatible capability, so it fits a separate[feat]changeset.
[Automated review]
…ndar-year-paging # Conflicts: # docs/specs/components/Calendar/Calendar.spec.md
|
/approve-spec 3453864 |
There was a problem hiding this comment.
Recommend approval. Shift+Page Up and Shift+Page Down now move Calendar's focused day by a year, with February 29 clamping to February 28 and the month step's min, max, constraint and two-month rules carried over. The six new tests fail without the change and pass with it, and plain Page Up and Page Down still move a month. The component:Calendar AR1 exception has an engineering owner's approval at this head, and the useGridFocus page-callback change was accepted as additive.
- Optional: the comment above
handlePageUp(Calendar.tsx:968-969) restates thee.shiftKey ? 'years' : 'months'argument; keeping only the reason would read better.
[Automated review]
| // PageUp/PageDown move by a month, and with Shift by a year (APG date | ||
| // picker dialog). |
There was a problem hiding this comment.
Optional (non-blocking): this comment restates the e.shiftKey ? 'years' : 'months' argument below. Keeping only the reason reads better, for example:
// The APG date picker dialog gives Shift+Page a year.
User impact
Keyboard users of Calendar, and of the date fields whose desktop picker is a Calendar, press Shift+Page Up or Shift+Page Down to move by a year. Instead, the focused day moves by one month, the same as Page Up and Page Down. Reaching a date a few years away, such as a birth date or an expiry date, takes twelve presses per year.
Problem and solution fit
The month grid now handles Shift+Page Up and Shift+Page Down first and asks for a year step. The year step runs through the same navigation code as the month step.
Expected behavior and authority
component:DateInputAR8 already names Shift+Page Up and Shift+Page Down moving by a year, for the touch calendar.component:CalendarAR1 names Page Up and Page Down moving by a month.spec:AST-020FR15 requires the owning record to name any key added beyond the grid pattern, so this PR adds the Shift+Page year step to AR1 as a named exception. The record change needs the Calendar owner's approval.Fixes #8947.
Smallest restoration
minormaxchanges nothing and keeps focus;useGridFocuspasses the key event toonPageUpandonPageDown, so Calendar reads Shift from it and there is one page-key path. This is additive: existing callbacks that take no argument still work and still type-check.Evidence
Calendar.test.tsxcases (year step, February 29, pastmax, constraint fallback, two-month view) and oneuseGridFocus.test.tsxcase (the page callbacks receive the key event). All six fail with the source change reverted.Writing rubric results
Screenshots
Real Chromium against Storybook. Focus starts on the day shown, then Shift+Page Down.
Scope
useGridFocuspassing the key event, is called out above.Testing
pnpm exec vitest run --project ui packages/core/src/Calendar packages/core/src/hooks/useGridFocus.test.tsx: 240 passed.pnpm check:knowledge: passes.data-dateand the grid name were read.