Repository navigation
fix(Calendar): the week-number corner cell is a named columnheader - #7509
Conversation
With hasWeekNumbers the header row's first cell had no role, so a grid row carried a child that was neither gridcell, columnheader nor rowheader (APG Grid; component:Calendar FR1). It is now a columnheader named 'Week' (screen-reader only, translated), matching the weekday headers beside it and the rowheader column it tops. FR1 states it; the verification row cites the new test.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewModified ComponentsCalendar (@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.
This change is on hold until a maintainer provides or identifies the governing spec for its one unsettled addition, the new public catalog key @astryx.calendar.weekNumberHeader ("Week"): what must be settled is whether built-in screen-reader strings may enter the locale catalog as new keys, as the description already notes. Separately, the PR accessibility audit fails with two new empty-table-header findings on the new corner header, because axe does not count aria-label as header text; giving the header its translated name as visually hidden text content, or recording an approved baseline exception, should clear it while the column stays visually blank.
[Automated review]
| // only so the column stays visually blank. | ||
| <div | ||
| role="columnheader" | ||
| aria-label={t('@astryx.calendar.weekNumberHeader')} |
There was a problem hiding this comment.
axe's empty-table-header rule, which fails this PR's accessibility audit on the week-number stories, counts only text content inside a header, not aria-label. Keeping the column visually blank with the name as text content clears it:
<div
role="columnheader"
{...stylex.props(monthGridStyles.dayName, monthGridStyles.weekNumberHeader)}>
<VisuallyHidden>{t('@astryx.calendar.weekNumberHeader')}</VisuallyHidden>
</div>The new test's getByRole('columnheader', {name: 'Week'}) still passes with a name from content.
…n text; no new catalog key plainDateWeekFieldName(locale) (plainDate.ts, an approved Intl file) reads Intl.DisplayNames dateTimeField 'weekOfYear' — inside the Baseline − 2 tier — with the English CLDR value as the fallback. The header renders it through VisuallyHidden, so axe's empty-table-header passes and the column stays blank. The @astryx.calendar.weekNumberHeader key is gone.
|
/approve-spec 172e8b7 |
There was a problem hiding this comment.
No changes are needed: the week-number corner is now a columnheader whose CLDR name is visually hidden, which matches the adopted Grid pattern while the column stays blank. The new test fails without the fix and passes with it, the accessibility audit is clean on both week-number stories, and the calendar renders pixel-identically before and after. One optional extra: a Calendar.test.tsx case that makes Intl.DisplayNames throw would cover the English fallback, which neither new test reaches.
[Automated review]
| expect(stray).toHaveLength(0); | ||
| // Named from CLDR ("week" in en-US), as visually hidden text. | ||
| expect( | ||
| within(grid).getByRole('columnheader', {name: 'week'}), |
There was a problem hiding this comment.
Optional hardening: neither new test reaches the English fallback in plainDateWeekFieldName, because ICU names zxx “week” through CLDR root. A case like this one covers it, passes at head, and stays inside the no-raw-intl-locale boundary because this file is an approved test oracle:
it('names the week-number corner "week" when the engine cannot name the field', () => {
const real = Intl.DisplayNames;
Object.defineProperty(Intl, 'DisplayNames', {
value: class {
constructor() {
throw new RangeError('unsupported type');
}
},
configurable: true,
writable: true,
});
try {
render(
<InternationalizationProvider locale="de-DE">
<Calendar focusDate="2026-01-01" hasWeekNumbers />
</InternationalizationProvider>,
);
expect(
within(screen.getByRole('grid')).getByRole('columnheader', {name: 'week'}),
).toBeInTheDocument();
} finally {
Object.defineProperty(Intl, 'DisplayNames', {value: real, configurable: true, writable: true});
}
});…target; merge main (#7509 week-number header)
…ts known-failure row goes; the ledger is empty
## 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 #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 `columnheader`s (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.
What changes for users
A screen-reader user reading a
CalendarwithhasWeekNumbersno longer meets a stray unnamed cell at the start of the weekday header row: the blank corner above the week-number column is now acolumnheadernamed 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-020FR15 (current) plus the owner's 2026-10-13 APG adoption approval. APG Grid requires every cell in arowto be agridcell,columnheaderorrowheader;component:CalendarFR1 names the grid structure. A namedcolumnheaderis what therowheadercolumn it tops implies (the APG uses header roles for header cells;presentationwould remove the cell from the grid's column model).Shape
Calendar.tsx: the corner cell getsrole="columnheader"and a<VisuallyHidden>child withplainDateWeekFieldName(locale)(text content, notaria-label, so axe'sempty-table-headerpasses).utils/plainDate.ts(an approved raw-Intlfile underno-raw-intl-locale):plainDateWeekFieldName(locale)readsIntl.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 onmain, green here.plainDate.test.ts:plainDateWeekFieldNamereturns "week"/"Woche" and is never empty.mainfor this, so none is deleted.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-numbersknown 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
#2715inside a verbatim quoted test title already in the row, left as the test names itself.R6 open questions: unchanged.