Skip to content

fix(Calendar): arrow keys skip borrowed adjacent-month days and cross into their month - #7478

Merged
cixzhang merged 16 commits into
fix/calendar-page-keysfrom
fix/calendar-skip-outside-days
Oct 14, 2026
Merged

cixzhang merged 16 commits into
fix/calendar-page-keysfrom
fix/calendar-skip-outside-days

Conversation

@cixzhang

@cixzhang cixzhang commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Problem

A keyboard user arrowing through a Calendar could land on a borrowed adjacent-month day — shown dimmed and exposed aria-disabled — and then Enter or Space picked nothing. useGridFocus's isCellFocusable read only native disabled (Calendar.tsx L803–804), and borrowed days are never natively disabled (a click on one navigates). component:Calendar FR5/AR1 (#7464) record this as an implementation gap under the Grid adoption.

Fix

isCellFocusable excludes [aria-disabled="true"] buttons. The hook already continues past non-focusable cells in the same direction and, at the grid edge, calls onNavigateBefore/After, so the month navigates and the pending focus lands on the real day in the month now shown — the behaviour FR5 describes. A borrowed day's click is inert (Calendar.tsx L1167 guards on effectivelyDisabled); pointer focus on one is still possible, which is why the Page-key fix keeps its from-a-borrowed-day clamp.

Stacked on the Page-key fix

Base branch: fix/calendar-page-keys (#7467), whose per-grid pending-focus rule (only the grid showing the target month acts) this fix depends on in a two-month view. New here: an arrow leaving one grid toward a day another grid already shows moves focus there without paging (January 28 → ArrowDown → February 4 in the second grid, view unchanged), while a target outside both grids pages and focuses the real day (February 24 → ArrowDown → March 3). Test: "in a two-month view an arrow from the first month lands on the real day, never a borrowed one" (numberOfMonths={2}).

Evidence

  • Calendar.test.tsx "skips borrowed adjacent-month days and crosses into their month instead": ArrowLeft from January 1, 2026 announces December 2025 and focuses the real December 31 (not aria-disabled). Red arm: fails with Calendar.tsx reverted to main (focus went to the borrowed copy).
  • Two existing cross-month tests ("ArrowDown moves focus +7 days…", "…locale-safe") rendered a controlled Calendar whose onFocusDateChange was a mock, so they passed only by focusing the borrowed February copy; they now use an owner that follows the focus date and assert the real February 4. Both fail on main's Calendar with the new assertions.
  • Calendar + DateInput suites 509/509; tsc, eslint, Prettier clean.

Changeset

@astryxdesign/core patch [fix].

Record

Per the fix-PR rule, this PR edits component:Calendar (now on main): FR5 says a borrowed adjacent-month day is aria-disabled, cannot be picked, and the keyboard skips it; AR1's remaining gap (arrows, Home and End focusing a borrowed day) is deleted — the gap list is now empty — and the verification row cites "skips borrowed adjacent-month days and crosses into their month instead" and "in a two-month view an arrow from the first month lands on the real day, never a borrowed one". Stacked on #7467, which removes the Page-key and two-month gaps.

Writing rubric results

R1 narration: none; FR5 and AR1 stay present tense.
R2 research: none in the record.
R3 evidence: the AR1 verification cell cites test titles, not this pull request.
R4 rejected alternatives: none added.
R5 change references: one #2715 inside a verbatim quoted test title (as in #7467), left as the test names itself.
R6 open questions: unchanged.

… into their month

A borrowed day is exposed aria-disabled but never natively disabled, and the
grid's focusability check read only native disabled, so an arrow could land
on a dimmed day Enter and Space could not pick (component:Calendar AR1/FR5,
APG grid). The check now excludes aria-disabled cells; the hook continues
past them to the grid edge and the month navigates, focusing the real day.
Two tests that relied on focusing the borrowed copy under a mocked
controlled owner now use an owner that follows the focus date. Red-armed.
@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 3:14am UTC

Request Review

@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, 3:43 AM UTC

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Previews ready: Storybook and Sandbox were built with this PR's docsite. CI evidence will be added when available.

View Storybook for this PR · View Sandbox for this PR

@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 can't be approved yet: the arrow-key behaviour it changes has no current spec on main — component:Calendar and spec:AST-020 FR15 exist only in open #7464 (where the Calendar record is still a draft and its FR5 says an arrow can land on a borrowed day) and #7458 — so a maintainer needs to land or identify a current record that states this behaviour, including how focus should cross between the panes of the two-month layout. Two fixes are also needed:

  • In a two-month Calendar (the DateRangeInput default), ArrowDown or ArrowRight from the first month's last week now pages the view and puts focus on the first day of the new second month (March 1 from January 28) or on a dimmed borrowed day (March 29 in the April pane from February 24), because every month grid applies the pending focus and the last grid's fallback wins; please focus only the real target day and add a numberOfMonths={2} test.
  • The changeset and the new code comment say clicking a borrowed day navigates, but its click handler does nothing, so please correct both.

[Automated review]

Comment on lines 807 to +810
isCellFocusable: cell =>
cell.querySelector('button:not([disabled])') !== null,
cell.querySelector(
'button:not([disabled]):not([aria-disabled="true"])',
) !== null,

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.

In the two-month layout (the DateRangeInput default) this sends ArrowDown/ArrowRight out of the first pane through navigateMonth, which pages the view, and the pending-focus effect then runs in both panes; the second pane does not contain the target, falls back to its first button:not([disabled]) (L840–842) and wins. Result: ArrowDown from January 28 shows February–March with focus on March 1, and ArrowDown from February 24 lands on the dimmed, aria-disabled March 29 in the April pane. Please apply pendingFocus only in the pane whose month contains it (matching a non-aria-disabled button) and add a numberOfMonths={2} test.

Comment thread packages/core/src/Calendar/Calendar.tsx Outdated
Comment on lines +803 to +804
// A borrowed adjacent-month day is exposed aria-disabled (never natively
// disabled, so a click on it still navigates); the keyboard skips it and

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.

A click on a borrowed day does not navigate: its handler is !state.effectivelyDisabled && onDayClick(date) (L1167), a no-op for outside days, and the visible month stays put. Suggest describing it as exposed aria-disabled but not natively disabled, without the navigation claim.

'@astryxdesign/core': patch
---

[fix] `Calendar`: the arrow keys no longer land on a borrowed adjacent-month day (shown dimmed and exposed as disabled, so Enter and Space picked nothing); they cross into that month and focus the real day there. Clicking a borrowed day still navigates as before.

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.

"Clicking a borrowed day still navigates as before" is not accurate: clicking a borrowed day does nothing, before and after this change (see the existing "outside days are not clickable" test). Suggest "Clicking a borrowed day still does nothing." or dropping the sentence.

…out paging; wording corrected

Merges the Page-key fix branch so every grid only claims a target in its own
month. An arrow leaving one grid toward a day another grid already shows
moves focus there without paging (January 28 → February 4 stays on
January/February; February 24 → March 3 pages). The comment and Changeset no
longer claim a borrowed day's click navigates: it is inert. Two existing
cross-month tests use an owner that follows the focus date.
@cixzhang
cixzhang changed the base branch from main to fix/calendar-page-keys October 13, 2026 18:51
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Oct 13, 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.

Changes requested: skipping borrowed days and the two-month crossing now work, but when a day disabled by min/max or dateConstraints sits between the focused day and the edge of the grid, the new no-page branch in navigateMonth sends focus to the month's first enabled day — for example, ArrowRight from Friday, January 30 in the WeekdaysOnly story lands on January 1, and ArrowDown from January 21 in WithDateConstraints lands on January 10 instead of staying put. Please resolve the arrow's target to the next enabled day in the arrow's direction before deciding whether to move within the visible grids or page, keep the existing behaviour where a key past min/max changes nothing, and add regression tests for both cases. Updating the stacked base with main would also drop the ten unrelated files from commits already on main that currently show in this diff.

[Automated review]

Comment thread packages/core/src/Calendar/Calendar.tsx Outdated
Comment on lines +416 to +428
if (focusedDate && unit === 'days') {
const arrowTarget = plainDateAddDays(
plainDateFromISO(focusedDate),
delta * (offset ?? 7),
);
const first = monthIndex(baseMonth);
const last = first + numberOfMonths - 1;
const target = monthIndex(arrowTarget);
if (target >= first && target <= last) {
setPendingFocus(plainDateToISO(arrowTarget));
return;
}
}

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.

When a day disabled by min/max or dateConstraints sits between the focused day and the grid edge, useGridFocus has already skipped it before calling onNavigateAfter/onNavigateBefore, but this branch rebuilds the target as that adjacent day, sets it pending and returns before the min/max guard; the pending-focus effect then falls back to the month's first enabled day. In the WeekdaysOnly story, ArrowRight from Friday, January 30 lands on January 1, and in WithDateConstraints (min January 10, max January 25) ArrowDown from January 21 lands on January 10 instead of staying put. Please resolve the target to the next enabled day in the arrow's direction before choosing between this branch and paging (changing nothing when none is in range), and add tests for both cases.

Comment thread packages/core/src/Calendar/Calendar.tsx Outdated
Comment on lines +879 to +880
// A borrowed adjacent-month day is exposed aria-disabled, never natively
// disabled (its click does nothing, but it can still take pointer focus);

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.

Minor: a borrowed day is natively disabled when a bound or constraint rules it out (disabled={isDisabled} on the day button) — for example the borrowed Sunday, February 1 in a weekdays-only grid — so "never natively disabled" is not quite right; perhaps "not natively disabled unless a bound or constraint disables it".

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 734041f

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Oct 13, 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.

Changes requested: skipping borrowed days, Home/End and the two-month crossing now behave as described, but the arrow keys still mishandle a disabled day just before the edge of a month grid. When a day disabled by min/max or dateConstraints sits between the focused day and the edge, the new no-page branch in navigateMonth targets that disabled day and focus falls back to the month's first enabled day — ArrowRight from Friday, January 30 in a weekdays-only calendar lands on January 1, and ArrowDown from January 21 with max January 25 lands on January 10 instead of staying put. Please resolve the arrow's target to the next enabled day in its direction before choosing between moving within the visible grids and paging (changing nothing when none is in range), and add tests for both cases.

[Automated review]

Comment thread packages/core/src/Calendar/Calendar.tsx Outdated
Comment on lines +416 to +428
if (focusedDate && unit === 'days') {
const arrowTarget = plainDateAddDays(
plainDateFromISO(focusedDate),
delta * (offset ?? 7),
);
const first = monthIndex(baseMonth);
const last = first + numberOfMonths - 1;
const target = monthIndex(arrowTarget);
if (target >= first && target <= last) {
setPendingFocus(plainDateToISO(arrowTarget));
return;
}
}

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.

When a day disabled by min/max or dateConstraints sits between the focused day and the grid edge, useGridFocus has already skipped it and reports only the step, so arrowTarget is that disabled day: it is set pending and the function returns before the min/max guard, and the pending-focus effect falls back to the month's first enabled day. With weekdays only, ArrowRight from Friday, January 30 lands on January 1; with min January 10 and max January 25, ArrowDown from January 21 lands on January 10, where it used to stay put. Please step from focusedDate by offset to the next enabled day (skipping bound- and constraint-disabled days) before choosing between this branch and paging, change nothing when none is in range, and add tests for both cases.

Comment thread packages/core/src/Calendar/Calendar.tsx Outdated
Comment on lines +879 to +883
// A borrowed adjacent-month day is exposed aria-disabled, never natively
// disabled (its click does nothing, but it can still take pointer focus);
// the keyboard skips it and crosses into that month through the grid
// edge instead, so focus lands on the real day in the month now shown
// (FR5).

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.

Minor: a borrowed day is natively disabled when a bound or constraint rules it out (disabled={isDisabled} on the day button), so "never natively disabled" is not quite right — perhaps "not natively disabled unless a bound or constraint disables it".

… this branch's no-page shortcut; borrowed days stay non-focusable (isCellFocusable); tests for the next-enabled-day walk, the no-day-in-range case and the exhausted direction; record edits re-applied
…/calendar-skip-outside-days

# Conflicts:
#	packages/core/src/Calendar/Calendar.spec.md
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec fb716d7

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

Recommending approval: the arrow keys, Home and End now skip the dimmed adjacent-month days and land on the real day in that month, across both grids of a two-month view too, and the earlier problem with a disabled day before the grid edge no longer reproduces on top of #7467's target-first navigation. Nothing blocks; two optional wording fixes are worth a look:

  • The new comment in Calendar.tsx says a borrowed day is "never natively disabled", but one ruled out by min, max or a constraint is.
  • FR5's new page clause says focus stays in the grid, but with only January 1–15 enabled, PageDown from January 10 drops focus to the page, so narrow the wording or fix that fallback in #7467.

This should merge after #7467.

[Automated review]

| FR2 | At most one day button in each month's grid holds `tabIndex={0}`; every other day button in that grid is `-1`. | shipped `useGridFocus` behavior; Grid accessibility contract (pending) | verify |
| FR3 | A disabled day (outside bounds or rejected by a constraint) stays in the grid, is exposed as disabled, and cannot be picked. | shipped source and focused tests | verify |
| FR4 | In `range` mode the first pick starts the range and the second ends it, a second pick before the start swapping the two so the end never precedes the start; `minRangeSpan`/`maxRangeSpan` bound it. Escape, or picking the start day again when `minRangeSpan` is above 1, clears an in-progress range. | shipped source and focused tests | verify |
| FR5 | Moving the focused day across a month boundary navigates the visible month so the focused day stays visible, in one month or two; a borrowed adjacent-month day is exposed `aria-disabled` and cannot be picked; arrow keys, Home and End skip it, and a page into a month with no enabled day focuses one so focus stays in the grid. | shipped source and focused tests | verify |

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.

Non-blocking: the page clause holds only when a borrowed day can take focus. With only January 1–15 enabled, PageDown from January 10 shows February and focus drops to the page, because every day button in February's grid, borrowed ones included, is disabled. The fallback and AR1's matching sentence come from the stacked Page-key change, so either narrow the wording here (for example "…focuses a borrowed day when one can take focus") or keep focus in the grid there.

…ed day; the focusability comment no longer claims borrowed days are never natively disabled
…/calendar-skip-outside-days

# Conflicts:
#	packages/core/src/Calendar/Calendar.spec.md
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 9be8bad

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec d27b8b9

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

Recommending approval: the arrow keys, Home and End now pass over the dimmed adjacent-month days, an arrow at a month edge lands on the real day in that month (moving into the other grid of a two-month view without paging), and the new and updated tests fail without the change and pass with it. Two optional touch-ups are noted inline: the changeset could also mention Home/End and the month with no Tab stop, and the new test helper separates getDayButton from its doc comment. Separately, after an arrow or Page key changes the month, the focus hand-off in #7467 leaves the grid's Tab stop on the month's default day instead of the focused day, which a small follow-up there could fix. This should merge after #7467.

[Automated review]

'@astryxdesign/core': patch
---

[fix] `Calendar`: the arrow keys no longer land on a borrowed adjacent-month day (shown dimmed, exposed as disabled, and inert to Enter, Space and clicks); they cross into that month and focus the real day there, including across the two grids of a two-month view.

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.

Optional: Home/End and Ctrl+Home/End also stop landing on borrowed days now, and a month with no enabled day no longer has a Tab stop. One clause naming them would make the release note cover every key that changes.

* "Thursday, January 15, 2026". Each button is the sole child of a
* role="gridcell" wrapper.
*/
/** A controlled Calendar whose owner follows the focus-date changes. */

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 helper now sits between getDayButton's doc comment (just above) and getDayButton itself, so that comment documents the wrong function. Moving the helper above the comment, or below getDayButton, keeps them together.

…geset names Home/End and the no-Tab-stop month; test helper doc comment re-attached
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 87b0419

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec fa3cb21

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

Changes requested, for one wording fix only: the arrow keys now pass over the dimmed adjacent-month days and land on the real day, including into the other grid of a two-month view, and five of the new and re-based tests fail without the change and pass with it. The changeset says Home and End also “cross into that month and focus the real day there”, but they never change the month — Home from January 3 stops at January 1 and End from March 30 at March 31 — so please limit the crossing clause to the arrow keys and say Home and End stop at the month's own first or last day (suggested wording inline). This still merges after #7467.

[Automated review]

'@astryxdesign/core': patch
---

[fix] `Calendar`: the arrow keys, Home and End no longer land on a borrowed adjacent-month day (shown dimmed, exposed as disabled, and inert to Enter, Space and clicks); they cross into that month and focus the real day there, including across the two grids of a two-month view. A month with no enabled day holds no Tab stop.

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.

Home and End (and Ctrl+Home/End) never change the month: they stop at the month's own first or last day in the row, so Home from January 3 lands on January 1 with January still shown, and End from March 30 on March 31. Only the arrow keys cross into the adjacent month. Suggested wording:

[fix] `Calendar`: the arrow keys, Home and End no longer land on a borrowed adjacent-month day (shown dimmed, exposed as disabled, and inert to Enter, Space and clicks); an arrow crosses into that month and focuses the real day there, including across the two grids of a two-month view, and Home and End stop at the month's own first or last day. A month with no enabled day holds no Tab stop.

// A borrowed adjacent-month day is exposed aria-disabled (its click does
// nothing, but it can still take pointer focus) and may also be natively
// disabled by bounds or a constraint; the keyboard skips it either way
// and crosses into that month through the grid edge instead, so focus

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.

Optional: Home and End skip borrowed days too but never cross the grid edge, so “the keyboard … crosses into that month” describes only the arrows; consider “an arrow crosses into that month through the grid edge instead”.

cixzhang added a commit that referenced this pull request Oct 14, 2026
…7509)

## What changes for users

A screen-reader user reading a `Calendar` with `hasWeekNumbers` no longer meets a stray unnamed cell at the start of the weekday header row: the blank corner above the week-number column is now a `columnheader` named with the locale's own word for the week field ("week", "Woche", "週" — from CLDR, rendered as visually hidden text so the column stays blank), so every cell in the header row has a grid role and the row's column count matches the week rows below it.

## Authority

Path (a): `spec:AST-020` FR15 (current) plus the owner's 2026-10-13 APG adoption approval. APG Grid requires every cell in a `row` to be a `gridcell`, `columnheader` or `rowheader`; `component:Calendar` FR1 names the grid structure. A named `columnheader` is what the `rowheader` column it tops implies (the APG uses header roles for header cells; `presentation` would remove the cell from the grid's column model).

## Shape

- `Calendar.tsx`: the corner cell gets `role="columnheader"` and a `<VisuallyHidden>` child with `plainDateWeekFieldName(locale)` (text content, not `aria-label`, so axe's `empty-table-header` passes).
- `utils/plainDate.ts` (an approved raw-`Intl` file under `no-raw-intl-locale`): `plainDateWeekFieldName(locale)` reads `Intl.DisplayNames(locale, {type: 'dateTimeField'}).of('weekOfYear')` — Chrome 106 / Safari 15.4 / Firefox 110, inside the Baseline − 2 tier — with the English CLDR value as the fallback. Not re-exported from the package. No new locale catalog key.
- `Calendar.test.tsx`: "with week numbers, the header row's corner cell is a named columnheader, so every row child is a grid cell" — red on `main`, green here. `plainDate.test.ts`: `plainDateWeekFieldName` returns "week"/"Woche" and is never empty.
- Record: FR1 names the week-number header cell; the FR1–FR5 verification row cites the new test. No gap sentence was on `main` for this, so none is deleted.
- Changeset (patch).

## Order

Queued after #7467 and #7478 (same component; independent files but the record's FR1–FR5 row is shared). When this merges after #7499, that binding's `single-week-numbers` known failure becomes an unexpected pass and is emptied there.

## Writing rubric results

R1 narration: none; FR1 stays present tense.
R2 research: none in the record.
R3 evidence: the verification cell cites test titles, not this pull request.
R4 rejected alternatives: none added.
R5 change references: one `#2715` inside a verbatim quoted test title already in the row, left as the test names itself.
R6 open questions: unchanged.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 58a673a

…/calendar-skip-outside-days

# Conflicts:
#	packages/core/src/Calendar/Calendar.spec.md
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec e8f17e4

cixzhang added a commit that referenced this pull request Oct 14, 2026
…7467)

## Problem

A keyboard user in a Calendar pressed PageDown: the grid showed the next month, but focus moved only seven days — often still in the old month, now off screen, or on the wrong day. `component:Calendar` AR1 (APG Grid adoption) requires PageUp/PageDown to move the focused day by a month; the record names this as an implementation gap until this fix.

## Fix

`Calendar.tsx`: `navigateMonth` takes a unit. Arrow keys crossing a month edge keep their day offset (unchanged); the Page handlers pass `'months'`, so the focused day moves through `plainDateAddMonths`, which keeps the day of the month where it exists (Jan 31 → Feb 28). The month grid's `onNavigatePrevious`/`onNavigateNext` carry the unit; nothing else changes.

## Evidence

- `Calendar.test.tsx`: "moves the focused day by a month with PageDown and PageUp, into the month now shown" — from Jan 31, PageDown shows February and focuses February 28; PageUp shows January and focuses January 28. Red arm: with `Calendar.tsx` reverted to main the test fails (focus stayed a week away); with the fix 189/189 Calendar tests and 314/314 DateInput tests pass.
- tsc and eslint clean.

## Changeset

`@astryxdesign/core` patch `[fix]`.

## Record

`component:Calendar` AR1 names this gap in #7464.

## Record

Per the fix-PR rule, this PR edits `component:Calendar` (now on `main`): FR5 drops the two-month exception (the per-grid pending-focus rule makes a key land on the target in whichever grid shows it); AR1's gap list drops the Page-key gap and the two-month gap and keeps only the borrowed-day gap for #7478; the AR1 verification row cites the four Page-key tests this PR adds.

## Writing rubric results

R1 narration: none; FR5 and AR1 stay present tense (gap clauses deleted, not rephrased as history).
R2 research: none in the record.
R3 evidence: the AR1 verification cell cites test titles, not this pull request.
R4 rejected alternatives: none added.
R5 change references: one `#2715` appears inside a verbatim test title the verification row quotes ("caps the range highlight next to a disabled mid-range day (#2715)") — a title, not standing content; left as the test names itself.
R6 open questions: 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.

Recommending approval: the arrow keys now pass over the dimmed adjacent-month days and land on the real day — in the other grid of a two-month view without paging, or in the newly shown month — and Home and End stop at the month's own first or last enabled day, exactly as the updated release note now says. Five of the new and re-based tests fail without the change and pass with it, and the Calendar, date-input and grid suites, typecheck, lint and format checks pass. Nothing else is needed here; this merges after #7467.

[Automated review]

@cixzhang
cixzhang merged commit 988268e into fix/calendar-page-keys Oct 14, 2026
12 checks passed
cixzhang added a commit that referenced this pull request Oct 14, 2026
… into their month (#7511)

**Re-land of #7478, which merged into a stale base** (`fix/calendar-page-keys`, #7467's branch, after GitHub had not yet retargeted it to `main`). This PR carries exactly #7478's change — its final head e8f17e4's four files on top of `main` @ 666ad2f (#7467): Changeset +7; `Calendar.spec.md` +6/−10; `Calendar.test.tsx` +141/−16; `Calendar.tsx` +8/−1.

## Problem

A keyboard user arrowing through a Calendar could land on a borrowed adjacent-month day — shown dimmed and exposed `aria-disabled` — and then Enter or Space picked nothing. `useGridFocus`'s `isCellFocusable` read only native `disabled` (Calendar.tsx L803–804), and borrowed days are never natively disabled (a click on one navigates). `component:Calendar` FR5/AR1 (#7464) record this as an implementation gap under the Grid adoption.

## Fix

`isCellFocusable` excludes `[aria-disabled="true"]` buttons. The hook already continues past non-focusable cells in the same direction and, at the grid edge, calls `onNavigateBefore/After`, so the month navigates and the pending focus lands on the real day in the month now shown — the behaviour FR5 describes. A borrowed day's click is inert (Calendar.tsx L1167 guards on `effectivelyDisabled`); pointer focus on one is still possible, which is why the Page-key fix keeps its from-a-borrowed-day clamp.

## Stacked on the Page-key fix

Base branch: `fix/calendar-page-keys` (#7467), whose per-grid pending-focus rule (only the grid showing the target month acts) this fix depends on in a two-month view. New here: an arrow leaving one grid toward a day another grid already shows moves focus there **without paging** (January 28 → ArrowDown → February 4 in the second grid, view unchanged), while a target outside both grids pages and focuses the real day (February 24 → ArrowDown → March 3). Test: "in a two-month view an arrow from the first month lands on the real day, never a borrowed one" (`numberOfMonths={2}`).

## Evidence

- `Calendar.test.tsx` "skips borrowed adjacent-month days and crosses into their month instead": ArrowLeft from January 1, 2026 announces December 2025 and focuses the real December 31 (not aria-disabled). Red arm: fails with `Calendar.tsx` reverted to main (focus went to the borrowed copy).
- Two existing cross-month tests ("ArrowDown moves focus +7 days…", "…locale-safe") rendered a controlled Calendar whose `onFocusDateChange` was a mock, so they passed only by focusing the borrowed February copy; they now use an owner that follows the focus date and assert the real February 4. Both fail on main's Calendar with the new assertions.
- Calendar + DateInput suites 509/509; tsc, eslint, Prettier clean.

## Changeset

`@astryxdesign/core` patch `[fix]`.

## Record

Per the fix-PR rule, this PR edits `component:Calendar` (now on `main`): FR5 says a borrowed adjacent-month day is `aria-disabled`, cannot be picked, and the keyboard skips it; AR1's remaining gap (arrows, Home and End focusing a borrowed day) is deleted — the gap list is now empty — and the verification row cites "skips borrowed adjacent-month days and crosses into their month instead" and "in a two-month view an arrow from the first month lands on the real day, never a borrowed one". Stacked on #7467, which removes the Page-key and two-month gaps.

## Writing rubric results

R1 narration: none; FR5 and AR1 stay present tense.
R2 research: none in the record.
R3 evidence: the AR1 verification cell cites test titles, not this pull request.
R4 rejected alternatives: none added.
R5 change references: one `#2715` inside a verbatim quoted test title (as in #7467), left as the test names itself.
R6 open questions: unchanged.
@cixzhang
cixzhang deleted the fix/calendar-skip-outside-days branch October 14, 2026 04:25

This branch was successfully deployed

1 active deployment
Preview — e8f17e45 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