Skip to content

test(a11y): Grid contract and Calendar binding - #7499

Merged
cixzhang merged 15 commits into
mainfrom
a11y-grid-contract
Oct 14, 2026
Merged

cixzhang merged 15 commits into
mainfrom
a11y-grid-contract

Conversation

@cixzhang

@cixzhang cixzhang commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What this proves

component:Calendar AR1 (the Grid adoption recorded in component:Calendar, now on main, under spec:AST-020 FR15) has an executable contract and a binding. A keyboard or screen-reader user in a Calendar month gets: a named grid whose rows are rows of gridcells (with a column-header row), one Tab stop per grid, selected days exposed as selected (and the grid marked multi-selectable in range mode), the arrows moving one cell at a time in reading order, Home/End to the ends of the week row, and Enter picking the focused day.

Test-only: no runtime, docs, or Changeset. Enforcement follows spec:AST-020 FR9: the APG Grid's required parts are required; Enter's default action (author-determined in APG, defined by the record) is advisory until component:Calendar is current.

Expectations (AST-020 FR13)

Expectation Sources Layer Enforcement
grid.container.role-and-name WCAG 4.1.2, APG Grid, APG Grid accessibility-tree required
grid.structure.rows-and-cells WCAG 1.3.1, APG Grid dom required
grid.focus.single-tab-stop WCAG 2.1.1, WCAG 2.4.3, APG Grid dom required
grid.selection.exposed WCAG 4.1.2, APG Grid, WAI-ARIA 1.2 dom required
grid.keys.arrows WCAG 2.1.1, APG Grid real-browser required
grid.keys.home-end WCAG 2.1.1, APG Grid real-browser required
grid.keys.enter-activates WCAG 2.1.1, component:Calendar AR1 real-browser advisory

Exemptions: 1.1.1-non-text-content → the binding component and caller content; 1.3.1-info-and-relationships → the binding component (remainder only); 1.3.2-meaningful-sequence → the binding component; 1.3.5-identify-input-purpose → not applicable; 1.4.1-use-of-color → the binding component and theme; 1.4.3-contrast-minimum → the binding component and theme; 1.4.11-non-text-contrast → the binding component and theme; 2.1.1-keyboard → the binding component and composing page (remainder only); 2.1.2-no-keyboard-trap → the binding component and composing page; 2.4.2-page-titled → the page; 2.4.3-focus-order → the composing page (remainder only); 2.4.4-link-purpose → not applicable; 2.4.6-headings-and-labels → the binding component and caller content (remainder only); 2.4.7-focus-visible → the binding component and theme; 2.4.11-focus-not-obscured → the composing page; 2.5.2-pointer-cancellation → the binding component; 2.5.3-label-in-name → the binding component; 2.5.8-target-size → the binding component and theme; 3.1.1-language-of-page → the page; 3.2.2-on-input → the caller and composing page; 3.2.4-consistent-identification → the composing page; 3.3.1-error-identification → the binding component; 3.3.2-labels-or-instructions → the binding component and caller content; 4.1.2-name-role-value → the binding component (remainder only); 4.1.3-status-messages → the binding component and the assistive-technology verification record, spec:AST-009; apg-interaction → the binding component's record (remainder only); forced-colors → the binding component and theme; reduced-motion → the binding component and theme; at-facing-strings → the binding component

Known failures

None: the week-numbers corner-cell gap this binding first recorded was fixed on main by #7509 before this binding merged, so its row was emptied; every state passes every applicable expectation in jsdom and Chromium.

Shape

  • internal/a11y-spec/src/patterns/grid.ts — GRID_PATTERN, 7 expectations whose sources say what their pages say: APG Grid for roles, rows, naming, selection and the data-grid Tab/arrow/Home/End text (verified against the published pattern on 2026-10-13); WAI-ARIA 1.2 for aria-multiselectable; component:Calendar AR1 (pinned) for Enter/Space picking the focused day, which the APG leaves author-determined; every other checklist dimension exempted to a named owner with a verification method. Structure counts use the new Subject.descendantCount(selector).
  • grid.fixtures.ts — a 3×3 HTML grid whose <script> implements the roving-tabindex data-grid model; every expectation has at least one violating twin (GRID_MUTATIONS, 10 mutations).
  • grid.jsdom.test.ts (24 cases) and grid.chromium.spec.ts.
  • internal/a11y-spec/src/harness.ts + harness/{jsdom,chromium}.ts — Subject.descendantCount; (Home/End keys came in with the Slider contract.)
  • packages/core/src/Calendar/__tests__/Calendar.a11y.{states,renders,test}.tsx and Calendar.a11y.chromium.spec.ts — four states, each starting on January 14, 2026 with a full in-month neighbourhood: single with January 20 selected; the same under RTL (ArrowLeft moves to the next day); single with hasWeekNumbers (its corner-cell header, fixed by fix(Calendar): the week-number corner cell is a named columnheader #7509); a two-month range (January 20–22) with the first grid as the subject (Enter starts a new range there, so the activation row does not apply). Related subjects: start, startCell, next, previous, below, above, rowStart, rowEnd.
  • apps/storybook/stories/CalendarGridA11y.stories.tsx — one no-visual story per state through renderCalendarState.
  • .github/workflows/ci.yml — "Run Grid accessibility contract" step; scope through pr-scope-touches.sh from the base; runs when Calendar, useGridFocus, the harness, the stories, or the contract change.
  • README row and index export.

Source lines behind the binding facts

role="grid" + aria-label={monthLabel} + aria-multiselectable in range mode (Calendar.tsx L888–892); header role="row" of columnheaders (L901–913); week role="row"s of role="gridcell"s (L927, L1112); roving tabIndex via useGridFocus with hasRovingTabIndex (L802–806); arrows/Home/End in useGridFocus.ts; Enter picks the focused day (handleDayClick, L432–448).

Ownership exclusions

CALENDAR_EXCLUSIONS: disabled-day arrow skipping (an arrow that meets a day disabled by bounds or a constraint skips it and continues — component:Calendar AR1's rule beyond the APG one-cell step; Calendar.test.tsx proves it, so the binding's states stay free of disabled days); month-edge crossing (component:Calendar FR5 — the APG grid stops at the edge, the record defines the crossing; every state starts mid-month); pointer selection (Calendar.test.tsx) and Page keys (owned by Calendar.test.tsx's five Page-key cases from #7467, now on main). DateInput's month panes bind in their own change.

Moved and retained local tests (AST-021 FR6, FR14)

Moved into the binding: Calendar.test.tsx "sets aria-multiselectable="true" on the grid in range mode" (→ grid.selection.exposed on the range-two-months state, same DOM layer). Retained: "sets aria-multiselectable on both grids in a two-month range view" (the second grid, which the binding does not subject) and "does not set aria-multiselectable in single mode" (cited by component:Calendar AR1); "has accessible grid structure" and "renders a valid APG grid: one grid, header row of columnheaders inside it, week rows of gridcells" (cited by AR1/FR1–FR5 — removal blocker: the record is draft and cites them; they come out with the record pass that makes it current); "with week numbers, the header row's corner cell is a named columnheader, so every row child is a grid cell" (the stray-child check that red-armed #7509; cited by FR1–FR5 — same blocker).

Evidence

  • Vitest Calendar directory green (incl. 8 binding cases); pattern jsdom self-test 24/24; a11y-spec package tests green; tsc (core, a11y-spec, storybook), eslint, Prettier, use-client, visual-workflow-owner clean.
  • Real Chromium: the CI step on this PR runs the fixture self-test (conforming pass, every mutation fails) and the four binding states, with no known failures.

GRID_PATTERN encodes the APG Grid parts component:Calendar AR1 adopts as one
composite control: grid role and name, row and gridcell/columnheader
structure, one Tab stop, aria-selected/aria-multiselectable, the arrows one
cell at a time in reading order, Home/End within the row, and Enter selecting
the focused cell (advisory: author-determined, defined by the draft record).
Edge crossing into another month, Page keys and pointer selection stay with
the component. Fixtures carry a script implementing the roving-tabindex
model; the harness gains Home/End and Subject.descendantCount(selector) for
structure counts. The Calendar binding has three states (single with a
selection, RTL, two-month range: the first grid). DateInput's month panes
follow in their own binding. Stories through the shared renderer, CI step,
README. Test-only.
# Conflicts:
#	.github/workflows/ci.yml
#	internal/a11y-spec/README.md
#	internal/a11y-spec/src/harness.ts
#	internal/a11y-spec/src/harness/chromium.ts
#	internal/a11y-spec/src/index.ts
@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 4:33am 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, 4:54 AM UTC

@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

Calendar (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1642 -
Complexity N/A Very High (171) -

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.

Changes requested: the Grid contract and its fixture proof look solid, but the Calendar binding's Chromium lane never loads its stories, so pr-a11y fails and the browser evidence this PR relies on is missing.

  • Calendar.a11y.states.ts builds story ids as a11y-calendar-grid--… while Storybook generates a11y-calendargrid--… for A11y/CalendarGrid; fixing the prefix (or retitling the story) makes all four Calendar Chromium tests pass, after which the description's "Known failures: None" holds.
  • Three citations in grid.ts quote text the APG Grid pattern does not contain (the Enter "default action" sentence, the aria-multiselectable sentence and the paraphrased one-Tab-stop rule), so please cite the real source for each, such as WAI-ARIA 1.2 for aria-multiselectable.
  • The Calendar Chromium tests are titled TreeList [...] and should name Calendar.

[Automated review]

};
}

const story = (id: string) => `a11y-calendar-grid--${id}`;

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.

Storybook indexes the title A11y/CalendarGrid as a11y-calendargrid--single-selected, a11y-calendargrid--single-rtl and a11y-calendargrid--range-two-months, so these ids point at stories that don't exist and every Calendar Chromium test times out waiting for the grid (the pr-a11y failure on this PR).

const story = (id: string) => `a11y-calendargrid--${id}`;

Retitling the story A11y/Calendar Grid works too. With only this change, all four Calendar Chromium tests pass.

});

for (const state of CALENDAR_BINDING_STATES) {
test(`TreeList [${state.id}] — ${state.summary}`, async ({page}) => {

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 is the Calendar binding, but the title says TreeList, so the CI evidence report attributes these results to TreeList.

test(`Calendar [${state.id}] — ${state.summary}`, async ({page}) => {

Comment thread internal/a11y-spec/src/patterns/grid.ts Outdated
K,
);
const APG_ACTIVATE = apgReq(
'Enter or Space: performs the default action for the focused cell, when the cell has one.',

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 sentence isn't on the APG Grid page: APG leaves a cell's action to the author, and its only Enter guidance is "Enter: Disables grid navigation and: …" under Editing and Navigating Inside a Cell. It's the sole source of grid.keys.enter-activates and appears in every test title, so please cite a real source (for example the APG Button pattern's Enter/Space activation of the day button, with the action named by the Calendar record) and keep the row advisory.

Comment thread internal/a11y-spec/src/patterns/grid.ts Outdated
A,
);
const APG_SELECTION = apgReq(
'If the grid supports selection, when a cell or row is selected, the selected element has aria-selected set true. If multiple cells may be selected, aria-multiselectable is set to true on the grid.',

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.

The second sentence isn't APG text: the Grid pattern never mentions aria-multiselectable (it only says the selected element has aria-selected set true). WAI-ARIA 1.2 defines aria-multiselectable, and the existing web-standard source type fits it.

Comment thread internal/a11y-spec/src/patterns/grid.ts Outdated
A,
);
const APG_FOCUS = apgReq(
'The grid is one Tab stop: a roving tabindex gives exactly one cell (or one element inside a cell) tabindex 0 and the others -1, so Tab moves into the grid once and the arrow keys move within it.',

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 is a paraphrase rather than page text, and the page has no #keyboardinteraction section. APG's wording, under About This Pattern, is "Only one of the focusable elements contained by the grid is included in the page tab sequence."

Comment thread internal/a11y-spec/src/harness.ts Outdated
| 'PageUp'
| 'PageDown';
| 'PageDown'
| 'End';

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: 'End' is already in the union three lines up; this second one is a merge leftover with no effect.

@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: the story-id and test-title fixes landed and the Calendar binding now passes in Chromium, but a few traceability problems remain in the contract and the binding's records. The red test-node check comes from an unrelated CLI watch-mode test, not this change.

  • Three citations in grid.ts still present text as APG that the APG Grid page doesn't contain (the Enter “default action” sentence, the aria-multiselectable sentence, and the paraphrased one-Tab-stop rule), so please cite the real sources, such as WAI-ARIA 1.2 for aria-multiselectable.
  • The page-keys-and-pointer exclusion credits Page-key suites in Calendar.test.tsx, but its only Page-key test checks the PageDown announcement and nothing checks PageUp or where Page-key focus lands, so please name the real coverage and the known focus-target gap, or add the tests.
  • A Calendar with hasWeekNumbers fails the required grid.structure.rows-and-cells row because the header row's first cell has no role, so please record that as a known failure or explicit exclusion and update the description, which also mentions a check.test.ts update that isn't in the diff.

[Automated review]

Comment on lines +114 to +116
owner: 'Calendar.test.tsx (Page-key and pointer selection suites)',
reason:
'PageUp/PageDown move by a month (author-determined in the APG) and pointer selection are outside this keyboard-and-structure contract.',

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 credits Page-key suites in Calendar.test.tsx, but its only Page-key test checks that PageDown announces the next month; nothing tests PageUp or where Page-key focus lands, and useGridFocus.test.tsx has no Page-key test. Calendar's Page keys also send focus to the day a week away (Calendar.tsx L393–403), which the draft Calendar record lists as an implementation gap. AST-020 FR5 asks an exemption to name the actual owner or verification method, so please name the real coverage and that gap here, or add the tests.


const story = (id: string) => `a11y-calendargrid--${id}`;

export const CALENDAR_BINDING_STATES = [

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.

All three states use the default layout. With hasWeekNumbers, the header row starts with an unroled cell (Calendar.tsx L902–909) while week rows start with a rowheader, and running that layout through GRID_PATTERN fails the required grid.structure.rows-and-cells row (“1 row child(ren) are not gridcell, columnheader or rowheader”). AST-020 FR13 asks the PR to state known component gaps, so please record it here, as a week-numbers state with an exact known failure (as the Slider binding does) or an explicit exclusion; fixing Calendar can follow separately.

…ia-multiselectable, the APG data-grid Tab text, component:Calendar AR1 for Enter/Space); a week-numbers state records the corner cell's missing role as an exact known failure; the Page-key exclusion names the real coverage

@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: the Grid contract and Calendar binding hold up, and the Enter and aria-multiselectable citations, the Page-key exclusion and the week-numbers gap are now fixed, but two things remain.

  • APG_FOCUS in grid.ts still quotes text the APG Grid page doesn't contain (its data-grid keyboard section has no Tab entry), so please quote APG's own sentence: “Only one of the focusable elements contained by the grid is included in the page tab sequence.”
  • The branch conflicts with main in .github/workflows/ci.yml, where the TreeList row-naming step now sits at the same spot, so CI hasn't run on this revision; please merge or rebase, keep both steps, and let CI run.

[Automated review]

Comment thread internal/a11y-spec/src/patterns/grid.ts Outdated
url: 'https://www.w3.org/TR/wai-aria-1.2/#aria-multiselectable',
};
const APG_FOCUS = apgReq(
'Keyboard Interaction For Data Grids: Tab: Moves focus to the next focusable element. When a grid is in focus, the focus is on a single cell or widget inside a cell; the grid contains one Tab stop, and the roving tabindex technique keeps the focused cell as the only element with tabindex="0".',

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 isn't APG text: the page's Keyboard Interaction For Data Grids section lists only the arrows, Page Up/Down, Home/End and Control+Home/End; its only Tab entry (under Editing and Navigating Inside a Cell) moves focus to the next widget while grid navigation is disabled; and it never mentions a roving tabindex or tabindex="0". APG states the one-Tab-stop rule under About This Pattern:

Only one of the focusable elements contained by the grid is included in the page tab sequence.

Quoting that sentence, with that section's anchor, keeps this required row's source exact (AST-020 FR2/FR4).

facts: facts({
multiselectable: true,
selectedCount: 3,
enterSelectsStart: false,

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: starting a range does expose the day as selected. The in-progress start renders as a one-day range, so its gridcell gets aria-selected="true", and pressing Enter on January 14 in this story does exactly that. enterSelectsStart: true would let the advisory Enter row cover range mode too.

'2.1.1-keyboard': {
owner: 'the binding component and composing page',
verifiedBy:
"the component's month-navigation and Page-key tests, plus page-level keyboard review",

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: Calendar has one Page-key test today (the PageDown announcement in Calendar.test.tsx), so naming that and the recorded gap here, as the binding's exclusion now does, would avoid crediting Page-key tests that don't exist yet.

@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: the Grid contract and Calendar binding pass in jsdom and Chromium, CI is green, and the earlier citation-text and merge-conflict issues are fixed, but three small conformance items remain.

  • Remove or rewrite the Calendar.test.tsx assertions the binding now proves at the same layer (at least the range-mode aria-multiselectable test), or list them in the description with their removal blocker (AST-021 FR6, FR14).
  • Cover a bounded or constrained state, or record why disabled-day movement stays with the component tests, since Calendar's arrows skip disabled days (AST-021 FR4).
  • Point APG_FOCUS at the APG page's About This Pattern section, where the quoted one-Tab-stop sentence lives (AST-020 FR4).

[Automated review]

Comment thread internal/a11y-spec/src/patterns/grid.ts Outdated
};
const APG_FOCUS = apgReq(
'Only one of the focusable elements contained by the grid is included in the page tab sequence.',
K,

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.

On the published APG Grid page this sentence is under About This Pattern; K links Keyboard Interaction For Data Grids, which lists only the arrows, Page Up/Down, Home/End and Control+Home/End. Other contracts in this package link that section as #aboutthispattern:

const APG_FOCUS = apgReq(
  'Only one of the focusable elements contained by the grid is included in the page tab sequence.',
  'aboutthispattern',
);

},
] as const satisfies ReadonlyArray<CalendarBindingState>;

export const CALENDAR_EXCLUSIONS = [

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.

Calendar's arrows skip natively disabled days (Calendar.tsx L803–804; Calendar.test.tsx “ArrowUp skips a disabled cell in the same column to the next enabled row (complex-2)”), which changes the one-cell grid.keys.arrows outcome, but no state here sets min, max or dateConstraints and no exclusion says why (AST-021 FR4). A constrained state, or an entry like the edge-crossing one (plus the inventory test's id list), would close it:

{
  id: 'disabled-day-skip',
  owner: 'Calendar.test.tsx disabled-skip suites (complex-2)',
  reason:
    'An arrow skips a day disabled by bounds or a constraint and continues in the same direction; the APG grid moves one cell, so that movement stays with the component tests.',
},

evidenceLayer: 'dom',
enforcement: 'required',
run: async ({subject, facts}) => {
const rows = await subject.descendantCount('[role="row"]');

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: this row counts explicit role attributes and direct children, but APG lets rows and cells be DOM descendants or owned, and notes that in a table-based grid tr has the implied role row. A table with role="grid" and native rows fails here with “the grid contains no role="row"”. Calendar and the other grids in the repository use explicit roles, so nothing fails today; counting implied table roles, or documenting the restriction, would keep the contract reusable.

Comment thread internal/a11y-spec/src/harness.ts Outdated
| 'PageUp'
| 'PageDown';
| 'PageDown'
| 'End';

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: 'End' is already in the union at L153, so this second one has no effect and can go.

# Conflicts:
#	.github/workflows/ci.yml
#	internal/a11y-spec/README.md

@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: the Grid contract and Calendar binding pass in jsdom and real Chromium, but this update only merged main, so three small conformance items remain.

  • Record in CALENDAR_EXCLUSIONS why disabled-day arrow movement stays with the component tests, or add a bounded or constrained state, since Calendar's arrows skip disabled days (AST-021 FR4).
  • Remove or rewrite the Calendar.test.tsx assertions the binding now proves at the same layer (at least the range-mode aria-multiselectable test), or name them in the description with their removal blocker (AST-021 FR6, FR14).
  • Point APG_FOCUS at the APG page's About This Pattern section, where its quoted sentence lives (AST-020 FR4).

[Automated review]

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.
…ay arrow skipping recorded as a component-owned exclusion
# Conflicts:
#	.github/workflows/ci.yml
#	internal/a11y-spec/README.md
…ts known-failure row goes; the ledger is empty
# Conflicts:
#	.github/workflows/ci.yml
#	internal/a11y-spec/README.md
#	internal/a11y-spec/src/harness.ts

@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: the Grid contract and Calendar binding pass in jsdom and real Chromium, and the disabled-day, About This Pattern and duplicate End points are settled, but two records in the binding no longer match the code they describe.

  • With main's Page-key fix (#7467) merged in, Calendar.test.tsx now tests where PageUp and PageDown land and the Calendar record lists no Page-key gap, so the page-keys-and-pointer exclusion and the description's matching paragraph should name those tests as the owner instead of a gap.
  • The retained-test ledger should also name has accessible grid structure and the week-number corner-cell test's stray-row-child check, which the binding now proves at the same layer, and either remove sets aria-multiselectable="true" on the grid in range mode or give it a blocker that holds, since no verification row cites it (AST-021 FR6, FR14).

[Automated review]

Comment on lines +134 to +137
owner:
'Calendar.test.tsx pointer selection suites; Page-key focus targets are the gap component:Calendar AR1 records',
reason:
"PageUp/PageDown move by a month (author-determined in the APG) and pointer selection are outside this keyboard-and-structure contract. Today Calendar.test.tsx covers only the PageDown month announcement ('announces the next month when paging the grid with PageDown'); where Page-key focus lands, and PageUp, are the recorded AR1 gap that its own fix closes with tests.",

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 entry predates the Page-key fix that came in with main (#7467): Calendar.test.tsx now asserts where PageDown and PageUp land (“moves the focused day by a month with PageDown and PageUp, into the month now shown” and the paging cases after it), and component:Calendar AR1 no longer lists a Page-key gap. Naming those cases as the owner keeps the exclusion accurate (AST-020 FR5), for example:

{
  id: 'page-keys-and-pointer',
  owner:
    'Calendar.test.tsx paging cases and pointer selection suites, under component:Calendar AR1',
  reason:
    "PageUp/PageDown move by a month (author-determined in the APG) and pointer selection are outside this keyboard-and-structure contract. Calendar.test.tsx owns where Page-key focus lands ('moves the focused day by a month with PageDown and PageUp, into the month now shown' and the paging cases after it).",
},

The description's Ownership exclusions paragraph needs the same update.

owner:
'Calendar.test.tsx (bounds and dateConstraints suites) and component:Calendar AR1',
reason:
"An arrow that meets a day disabled by `min`/`max` or a `dateConstraints` rule skips it and continues in the same direction, crossing the month edge when it must — a behaviour the Calendar record defines (AR1) beyond the APG grid's one-cell step, so this contract's arrow row keeps its states free of disabled days. Calendar.test.tsx proves the skip ('ArrowUp skips a disabled cell in the same column to the next enabled row (complex-2)', the weekdays-only and max-bound arrow cases) and owns it.",

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: AR1 now separates the two cases. A day disabled by a constraint is skipped (“an arrow skips a day disabled by a constraint and continues in the same direction”), but “an arrow or Page key whose target lies past min or max changes nothing and keeps focus where it is”, which is what the max-bound case cited here (“an arrow past max changes nothing and leaves no pending target behind”) shows. Rewording the min/max half keeps this entry true to the record it cites.

verifiedBy:
'component:Calendar AR1 and FR5, which adopt the pattern as one composite control and define edge crossing and Page keys',
reason:
"This contract encodes the grid structure, the single Tab stop, the arrows within the grid, Home/End and Enter. Edge crossing into another month, Page keys and selection by pointer are the binding's.",

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: APG's data-grid keys also include Control+Home and Control+End, which useGridFocus ships for Calendar (useGridFocus.ts L528–556) but this contract doesn't encode and this reason doesn't name. AST-020 FR15 doesn't adopt them, so saying so here (or assigning them to the binding) would make the remainder explicit (FR5).

… owner; the single-grid range aria-multiselectable test moves to the binding (grid.selection.exposed on the range state)

@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: the Grid contract and Calendar binding pass in jsdom and real Chromium, and the Page-key exclusion and the moved and retained Calendar.test.tsx assertions now line up with the tests and the Calendar record. Two optional cleanups remain: the description's "Source lines behind the binding facts" still cites Calendar.tsx line numbers from before the merged fixes, and the disabled-day-arrows exclusion (and the matching description sentence) still says arrows skip days disabled by min/max, while the Calendar record and the max-bound tests it cites show such an arrow changes nothing.

[Automated review]

@cixzhang
cixzhang merged commit 50e1a31 into main Oct 14, 2026
56 checks passed
@github-actions
github-actions Bot deleted the a11y-grid-contract branch October 14, 2026 06:22

This branch was successfully deployed

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