Skip to content

fix(core): Calendar nightly audit — provider locale in an announcement, 320px reflow, forced-colors selection - #5453

Merged
cixzhang merged 3 commits into
mainfrom
night-watch-component-audit/Calendar/2026-08-24
Aug 25, 2026
Merged

cixzhang merged 3 commits into
mainfrom
night-watch-component-audit/Calendar/2026-08-24

Conversation

@cixzhang

@cixzhang cixzhang commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Nightly component audit of Calendar (core), rubric v1.8, against cd1a2daa59a.

Score Grade Open BLOCKs
Before 78.6 C 2
After 85.9 B 0

Every finding below was measured in real Chromium before and after — not read off the source.


What this fixes

🔴 I21 — the cleared-range announcement was spoken in the host locale

Overlaps open work. #5296 fixes this at the root (plainDateFormat's locale default) and has been approved since 24 Aug; #5303 threads the provider locale through all twelve call sites, rewrites this same function, and adds a lint that makes the class of bug unrepresentable. Land #5296 first. This one-line change and its test are kept because they close the bug tonight and the test is worth keeping under either of those; expect a trivial conflict when #5303 rebases. The two of them also collide with each other — same changeset filename.

Calendar.tsx:465 formatted its date with plainDateFormat(date, DATE_FORMAT_WITH_WEEKDAY) and omitted the locale argument that the other nine call sites in the file pass. Intl.DateTimeFormat(undefined, …) falls back to the browser's locale, so this one announcement ignored InternationalizationProvider.

The new test makes it concrete — with the provider on ja-JP:

Expected: "2026年1月10日土曜日"
Received: "Cleared start date Saturday, January 10, 2026. Select a start date."

The expected string is the day button's own accessible name, which was already localized correctly. Red before, green after.

🔴 R1 — numberOfMonths={2} overflowed a 320px viewport

Measured at 320px CSS width:

before after
scrollWidth / clientWidth 504 / 320 320 / 320
calendar width 488px 288px
next-month button right edge 492px — off screen 292px — on screen

The document scrolled sideways (WCAG 1.4.10) and the next-month button sat outside the viewport. The docs actively recommend this configuration — "Show two months side by side when the user frequently selects dates that span a month boundary" — so the layout that failed is the one the component tells people to use.

monthsContainer now wraps. Above 488px nothing moves; below it the second month stacks.

Before / after at 320px:

before after

🟠 A14 — the selected date vanished under forced colors

Under forced-colors: active the selected day read backgroundColor rgb(255,255,255) / color rgb(0,0,0) / forced-color-adjust auto — identical to every unselected day, so a Windows High Contrast user could not see which date was selected.

Fixed with the pattern ToggleButton.tsx:56 already uses: Highlight / HighlightText plus forced-color-adjust: none, which a <button> needs because the UA otherwise keeps the native ButtonFace surface and ignores the authored fill. After: bg rgba(5,0,73,0.8), color rgb(255,255,255), forced-color-adjust none. A compiled-rule test guards it, in the same shape as the CheckboxInput / Skeleton / ToggleButton ones.

before after

🟡 D4 — a literal radius where a role token exists

borderRadius: '50%' on the day button → radiusVars['--radius-full']. Equivalent only while the box stays square, which is exactly the caveat the radius convention names — and the review found it does more than I claimed: in y2k the range endpoints stop poking out of a square band.

↩︎ Withdrawn: the ten 2px insets

I originally swapped these for --spacing-0-5 and the review loop blocked it, correctly. That 2px is (--size-element-md − --size-element-sm) / 2 — the gap between the day button and its cell — not a step on the spacing scale, and the two only coincide on the neutral theme:

neutral   (32 − 28)/2 = 2    --spacing-0-5 = 2px    hit target 32 in a 32px cell
matcha    (40 − 36)/2 = 2    --spacing-0-5 = 3px    hit target 42 in a 40px cell

On matcha the tokenised version grew the hit target past its cell and overlapped adjacent days by 2px. Reverted to the literal, with the geometry recorded in a comment so the next reader does not make the same swap. An absolute inset is a layout value and is sanctioned as-is.

Deriving it with calc() from the two size tokens would be better than either, and would also close butter's pre-existing 4px dead gap between adjacent day hit targets. That is its own measured change, not this one.

🧹 Dead code

An unused srOnly style that hand-rolled VisuallyHidden (§1 A17) with a deprecated clip: rect(…). Nothing referenced it.


Needs review — carried, not fixed

System-level, filed as #5451: the pressed overlay never paints, library-wide. Calendar's day button has no pressed state, and it turns out it cannot get one at the component level. I added the house :active overlay, measured it, and found it dead: StyleX gives a @media-nested :hover a higher priority bucket than a bare :active, so the compiled hover selector out-specifies the pressed one (3,4,0) vs (3,3,0) and wins while the pointer is down — which is the only time :active matches. The same masking applies to Button's four variants and AvatarGroupOverflow; Button only looks fine because its transform: scale(0.98) still fires. I backed my change out rather than ship dead CSS that reads like a fix, and filed one issue with the compiled-CSS evidence. Cousin of #5442.

Everything else here needs a decision rather than a correction, so none of it is touched:

  • A8/A9 — the range preview is hover-only. onDayHover is wired to onMouseEnter/onMouseLeave and nothing else, so a keyboard user arrowing toward the second endpoint sees no preview of the range they are about to commit. Wiring it to focus is a behaviour change, not a correction.
  • P30 — no label prop. A consumer cannot name the widget for its purpose ("Departure date"); the grid's only accessible name is the month it happens to be showing. Adding one is new public API.
  • P25 — no changeAction, where the convention says async-capable core components ship one. Also new API.
  • A10 — no coarse-pointer hit expansion. The day button is 28×28 in a 32×32 cell, over the 24px floor. Expanding to ~44px on coarse pointers would overlap the neighbouring days at a 32px pitch, which is worse; recorded with that reason rather than "fixed".
  • A7 / C3 — two Effects, one announcing and one moving focus. Both are on C3's bright line, but the harm the rule guards (a double fire) is provably absent and under test, and neither has an obvious handler to move to: a month change can originate in a controlled focusDate prop, which has no callback, and the focus target does not exist until the new grid has rendered.
  • A14, part two — the today ring also disappears under forced colors (box-shadow is stripped). The fix wants an outline, which would collide with the focus ring; left for a decision rather than guessed at.
  • Both themed stories pin mode="light" on their <Theme>, so under the dark toolbar global they render light-mode tokens against a dark page and are close to illegible. Visible in the contact sheet. A story fix, and <Theme>'s nested-mode semantics are subtle enough that I did not want to guess in this PR.

Verification

  • pnpm test — Calendar 148 pass (146 + 2 new). Full suite was 7 red on the first push — all in packages/cli, none Calendar's. #5452 fixed those fixtures on main; main is merged in and the two that CI blocks on now pass locally.
  • pnpm build, pnpm lint:strict (scoped), check:sync, check:changesets, typecheck:docs, check-use-client — clean.
  • pnpm a11y:audit --components Calendar — 0 violations over 20 stories, 0 new baseline entries, baseline file untouched.
  • pnpm rtl:audit --filter Calendar — measured, not N-A'd: D1 auto-pass on 2 icons, curated D2 pass, 0 fail, 0 surprise.
  • 92 Chromium captures over 16 stories × light / dark / matcha, including driven hover, focus-visible, active, mid-flight range preview, forced colors and 320px — contact sheet on assets/pr-5453.

Changeset is patch. No API added, no behaviour broken.

…nt, no 320px overflow, forced-colors selection

Nightly component audit of Calendar (rubric v1.8). Two BLOCKs and two FIXes,
each measured in Chromium before and after.

- I21: the range-cleared announcement formatted its date without the provider
  locale, so Intl fell back to the host locale. Nine sibling call sites pass it.
- R1: numberOfMonths={2} overflowed a 320px viewport (scrollWidth 504 against
  clientWidth 320) and pushed the next-month button off screen. The months
  container now wraps; nothing moves above 488px.
- A14: the selected date lost its fill entirely under forced colors, rendering
  identically to every other day. Highlight/HighlightText with
  forced-color-adjust: none, the pattern ToggleButton already uses.
- D4/D1: a literal 50% radius and ten raw 2px offsets replaced with
  --radius-full and --spacing-0-5.
- Dead srOnly style removed; it hand-rolled VisuallyHidden and nothing used it.

Two tests, each red before the fix and green after, and a narrow-container
story so the sweeps can see the reflow.
@vercel

vercel Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview Aug 25, 2026 12:31am

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 24, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Aug 24, 2026
@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

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 1487 -
Complexity N/A Very High (136) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.8KB 1.2KB

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

github-actions Bot added a commit that referenced this pull request Aug 25, 2026
Review loop caught this: the 2px is (--size-element-md − --size-element-sm) / 2,
the gap between the day button and its cell, not a step on the spacing scale.
Matcha sets --spacing-0-5 to 3px, so tokenising it grew the day's hit target to
42px inside a 40px cell and overlapped adjacent days by 2px.

Reverted to the literal, with the geometry recorded so the next reader does not
make the same swap. Deriving it with calc() from the two size tokens is the real
improvement — it would also close butter's pre-existing 4px dead gap — and wants
its own measured change.
@cixzhang

Copy link
Copy Markdown
Contributor Author

Thanks — the 320px reflow and the forced-colors selection are both right, and the radius change does something you didn't claim: in y2k the endpoints stop poking out of a square band.

before after

The ten 2px insets aren't spacing. That number is the gap between the day button and its cell — your own comment says so:

neutral   (32 − 28)/2 = 2    --spacing-0-5 = 2px    hit 32 in a 32px cell
matcha    (40 − 36)/2 = 2    --spacing-0-5 = 3px    hit 42 in a 40px cell

So on matcha adjacent days' hit targets overlap by 2px. The on-scale rule covers padding, margin and gap; an absolute inset is a layout value, sanctioned as-is.

On the locale line: #5296 fixes that at the root and was approved this afternoon; #5303 threads the provider locale through all twelve call sites and rewrites this same function. Worth landing #5296 instead of patching call sites one at a time.

Needs a merge with main too; #5452 fixed the fixtures CI is red on.

Revert the ten insets and I'm happy with the rest.

MERGE: hold(request changes — the inset tokens)

[Reviewed by Robohands]

@cixzhang

Copy link
Copy Markdown
Contributor Author

Fixed in f0b75aa — reverted to the literal, with the geometry recorded in a comment so the next reader doesn't make the same swap. Confirmed both halves of your evidence against the theme sources: matcha sets --spacing-0-5: 3px with --size-element-{sm,md} at 36/40px, and y2k sets --radius-full: 0px, which is why the endpoints go square. Main is merged in and the two CI fixtures that were red pass locally.

Carried, not fixed: deriving the inset with calc() from the two size tokens, which would also close butter's pre-existing 4px dead gap between adjacent day hit targets. That wants its own measured change.

github-actions Bot added a commit that referenced this pull request Aug 25, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

Thanks — insets reverted, geometry matches main on all four themes.

The body undersells this: in DateInput's popover the second month was clipped off-screen, not just overflowing.

before 320×568 after

MERGE: auto

[Reviewed by Robohands]

@cixzhang

Copy link
Copy Markdown
Contributor Author

Nit, not blocking — packages/core/src/Calendar/styles.ts monthsContainer: the wrap wants 544px of height, so at 320×480 September's tail goes under the fold.

Still strictly better than the before, where the month was unreachable rather than below it. Carried in the ledger row rather than fixed here.

@cixzhang
cixzhang merged commit 8d45788 into main Aug 25, 2026
20 checks passed
@github-actions
github-actions Bot deleted the night-watch-component-audit/Calendar/2026-08-24 branch August 25, 2026 06:12
AKnassa added a commit to AKnassa/astryx that referenced this pull request Sep 26, 2026
No textual conflicts. Calendar.tsx, Calendar.test.tsx, Calendar.doc.mjs
and styles.ts auto-merged cleanly alongside upstream's Calendar work
(meta#5306 min/max opening month, meta#5453 320px reflow, meta#5120/meta#5303 locale,
meta#6121 theme selectors).

Merge fallout fixed here:

- astracat F4: meta#6121 moved generated variant selectors from bare
  classes to data attributes, so the calendar-picker defineTheme
  assertion now expects `.astryx-calendar-picker[data-picker="year"]`
  instead of the stale `.astryx-calendar-picker.year`, matching how
  meta#6121 updated the sibling calendar-nav assertion. Red before: "expected
  ... to contain '.astryx-calendar-picker.year'" (Calendar.test.tsx:1885).

- Provider locale: meta#5120/meta#5303 moved the static caption onto the
  InternationalizationProvider locale and added the
  @astryx/no-raw-intl-locale lint rule, which the picker option labels
  (still undefined-locale) now fail. They pass `locale` like the caption
  again, so the two caption modes keep agreeing on month names. New test
  "labels the month picker in the provider locale, like the static
  caption" was red first (es-ES rendered "March", expected "marzo").

Calendar.test.tsx 112/112 green after both.

This branch was successfully deployed

1 active deployment
Preview — f0b75aa3 Deployed Aug 25, 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. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant