Repository navigation
Conversation
Calendar's caption was a static label, so reaching a distant month — a birth date, a years-old record — meant paging prev/next one month at a time, or falling back to error-prone typed input. Screen-reader and keyboard users bore the worst of it: "press next 200 times" is not a strategy. New hasMonthYearPickers prop (default off) replaces the caption with compact Month and Year pickers built from the existing ghost Selector — the same compact-embedding pattern Pagination uses, and the same popover machinery PowerSearch already nests, so a Calendar inside a DateInput popover stays layering-safe by construction. API shape follows house convergence rules rather than the RFC's react-day-picker vocabulary: no captionLayout/fromYear/toYear — the year list derives from the existing min/max bounds (1900–2099 when unbounded), always widened so the visible year stays labeled, with out-of-bounds months and years disabled rather than hidden. Jumps route through the same controlled/uncontrolled branch as prev/next, clamp into the [min, max] month window, and inherit the existing month-change screen-reader announcements. A two-month view keeps the static caption, which labels both visible months. Themeable via the new calendar-picker target (data-picker="month" | "year") on a wrapper node, since Selector splits className and data-* props across two elements. Tests written red-first (17 new, 3 more from adversarial review); mutation testing kills 7/7 targeted mutants, including the max-side clamp a first pass left unpinned. Known Selector-wide limitations, disclosed not patched here: closed-trigger typeahead double-announces (Selector speaks the label, Calendar the month), and arrow-opening a picker can highlight a disabled option where Enter is a silent no-op. Refs meta#4941
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewModified ComponentsCalendar (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Visual Regression1 of 422 shot(s) changed. A change here is a question, not a failure: check whether the after is the
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
kentonquatman
left a comment
There was a problem hiding this comment.
The sandbox preview isn't working right now for the design review. Would you be able to update or add screenshots to show the change?
|
The hosted previews for this PR 404 now, though Before and after
Left is the caption today, right is Year picker with The list offers 2024 to 2027 only, derived from the existing The jump clamps to June, the first month inside Dark mode
I left the two month view out because it is unchanged: the pickers are ignored when Happy to capture any other state that would help. |
|
@imdreamrunner, now that the mobile date-picker work has landed (#5243 and #5582), could you help us resolve the direction for this PR? Should these month/year caption pickers remain a desktop Calendar option, be shared with the mobile picker, or be superseded by the newer mobile navigation pattern? I would like to avoid landing a second navigation model that conflicts with the mobile experience. |
There was a problem hiding this comment.
Thanks for the detailed implementation, tests, and screenshots.
This change is waiting on a maintainer decision before it can be approved. The proposal adds a new public Calendar prop (hasMonthYearPickers), replaces the single-month caption with Month and Year dropdowns, adds bounds, clamping, and announcement behavior, and adds a new calendar-picker theme target — but there is no governing spec yet for that addition. The PR itself describes this as an implementation offer for the RFC while it awaits a design brief, so a maintainer needs to provide or identify the governing spec and settle, in particular:
- Whether this should remain an opt-in desktop Calendar feature, be redesigned to share the newer mobile date-picker navigation model, or be superseded by it
- The final prop name and shape, the year-range and
min/maxbehavior, and the two-month exception
One implementation point to fix if that direction is approved: styling set through the calendar-picker theme target (for example its color and fontWeight) currently lands on a wrapper and does not reach the visible picker label, because the inner Selector sets its own text color and font weight. Routing the target to the rendered control and checking the rendered styles would close that.
No changes are being requested solely because the spec is missing — approval is waiting on the maintainer spec decision above.
[Automated review]
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.
astracat F3: the calendar-picker target sits on a wrapper span (Selector puts className on its trigger container but data-* on the inner button, and meta#6121's variant rules need class and data-picker on one node), but the ghost Selector trigger sets its own color and font-weight, so a theme's color or fontWeight on the target painted the wrapper and never reached the visible Month/Year label. The wrapper (pickerItem) now owns the caption's color and weight, using the ghost Selector's defaults (--color-text-primary, medium) so the default look is unchanged, and each Selector gets xstyle={calendarStyles.pickerTrigger} to inherit both. Surface styles (background, padding, radius) on the target still paint the wrapper. Proof: new test "lets a color themed on calendar-picker reach the visible picker label" was red first (expected 'var(--color-text-primary)' to be 'rgb(255, 0, 0)') and is green now; Calendar suites plus themingTargets.test.ts 626/626.
The pre-commit hook (lint-staged: eslint --fix + prettier --write) ran over every file the upstream/main merge staged, so merge commit 2c30e68 also reformatted 14 upstream files this PR does not touch. This puts them back to upstream/main's exact bytes so the PR diff is only the 7 Calendar files again. Committed with --no-verify because upstream's own copies of these files fail `prettier --check`, so lint-staged would reformat them again. The hook's other half, `pnpm check:repo`, was run by hand and passes. Restored: IME_GUARD_DESIGN.md, apps/storybook/stories/MobileTokenizer.stories.tsx, internal/vibe-tests/stepper-collapse-naming-test/PLAN.md and docs/arm-{a-collapsed,b-bare,c-summary,d-enum,recall}.md, packages/core/src/Carousel/Carousel.test.tsx, packages/core/src/Chat/__tests__/ChatMessageMetadata.a11y.chromium.spec.ts, packages/core/src/TextInput/TextInput.test.tsx, packages/core/src/theme/syntax/index.ts, packages/lab/src/MobileTokenizer/MobileTokenizer.{tsx,test.tsx}.
|
Pushed an update at e170650, with main merged in.
Still open:
|
There was a problem hiding this comment.
Thanks for the careful implementation, tests and screenshots; the design review has approved the visuals, but approval still waits on a maintainer decision: no current spec covers month and year pickers in Calendar, so an engineering owner needs to provide or identify the governing spec and settle whether this stays an opt-in Calendar option, adopts the touch date field’s month/year wheels, or is superseded by them, including the prop name, the 1900–2099 default, the two-month exception and the calendar-picker target. An engineering owner (the author included, if they are one) records that decision by commenting /approve-spec <full head SHA> on this pull request.
Since the last review the Calendar spec became current on main and Calendar now renders calendar systems, so the branch conflicts and needs a rebase, and whichever way the decision goes these need fixing:
- Newly live check: the pickers list Gregorian months and years, but the current Calendar spec (FR8) requires the month heading to use the calendar system the grid shows, so on
mainthey would name Gregorian months over a Persian or Hebrew grid; build them on the same calendar month model the touch wheels use. - Newly live check: the month and year option lists and the year-change clamp duplicate
MonthYearWheelsinDateInput, which has already moved to calendar systems without this copy; share one helper between the two. - The calendar’s width follows the month name (260px in July to 310px in September, against a fixed 248px), so after one Next press from August a second click in the same spot opens the Year list; keep the grid’s width authoritative or give the Month trigger a stable width.
- The pickers always show Month before Year, so year-first locales such as hu-HU read
márciusthen2026.where the static caption reads2026. március(also ja-JP, ko-KR, zh-CN and zh-TW); order them from the locale’s month–year format and test one of those locales. - Newly live check: the month label uses the lower-case format form (
marzo, and the es-ES test pins it), while the current Calendar spec (FR1) requires the header’s stand-alone month to start with a capital in es, fr, pl and ru. - Newly live check:
data-pickeris a new public data attribute with no spec naming it; record it with thecalendar-pickerdecision or drop thepickervisual prop. - Newly live check: the title’s
corescope names no component, so the Calendar API rows sit outside the pull request’s scope; retitle itfeat(Calendar): …or add a## Scopesection withComponents: Calendar.
kentonquatman
left a comment
There was a problem hiding this comment.
Design looks good! Thanks @AKnassa!
|
(Posted by Cindy's agent.) Thank you, @AKnassa, for building this! Month and year menus would help people pick dates years away. Since this was written, Calendar has gained support for non-Gregorian calendar systems, and a fixed 1900–2099 Gregorian year list doesn't fit them. It also adds a new theming target. So we're closing this version; if month and year jump menus go ahead, they'll be rebuilt from a Calendar spec line that covers every calendar system and min/max, with you credited. |






What this does
Adds an optional month and year picker to the calendar header. Turn on
hasMonthYearPickersand the caption becomes two small dropdowns, so you can jump straight to June 1990 instead of clicking the arrow button dozens of times.Why
Picking a distant date (a birth date, an old record) takes one click per month today. That is slow for everyone and much worse for keyboard and screen reader users. This pattern is standard in every major date picker library.
Closes #4941
What changed
hasMonthYearPickersoption on Calendar, off by default. Nothing changes unless you turn it on.minandmaxlimits (1900 to 2099 when unlimited). Months and years outside the limits are disabled rather than hidden.calendar-pickertarget.How to see it
Run Storybook (
pnpm dev) and open Core/Calendar, stories "Month Year Pickers" and "Month Year Pickers With Min Max".Notes for maintainers
captionLayout,fromYear, andtoYear: the year range reuses the existingmin/maxprops instead of adding a second bounds vocabulary, per the API conventions. Glad to rework the shape if arbitration lands somewhere else.