Repository navigation
Conversation
🤖 PR meta 🤖🎉 PropsUnlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @rahul05ranjan. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: +808 B (+0.01%) Total Size: 8.57 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. Undo restores the post selection when another synced entity is loaded (RTC WebSocket) in
|
Seems reasonable for now. The main question for me is whether |
The story defined a datetime field but left it out of the form, so the calendar in a panel popover had no example. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The calendars had a fixed size of seven 32px columns, so wider containers, such as the DataForm date popover, left uneven space beside them. Render them as a block whose day columns share the available width, up to 48px each, while keeping the 32px day height. Calendars showing several months keep them side by side, each capped at the same width, and still wrap on narrow screens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Day buttons now keep a 1:1 aspect ratio as they grow, so the dashed range preview SVGs (drawn on a square viewBox) no longer spill into the next row. Months are laid out in an equal-column grid instead of a wrapping flex row, so a month that wraps onto its own row stays as wide as the others. Each month is still capped at the maximum day size when months stack. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New `--wp-ui-*` custom properties are public API and the prefix is frozen, so use the private `--_wp-ui-*` prefix for the internal maximum day size. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Calendar and RangeCalendar now grow to fill their container, which made them up to 336px wide (and as tall) in the regular layout. Cap the calendar at the width it has in the panel layout's 320px popover, so it looks the same in every layout, and let it fill the popover when other content makes the popover wider. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
a17c2b0 to
fbe4bee
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
How does this look to you? I read this is preferable to #85830 Unless I'm missing some use case, it seems to me we could go ahead with this: it's an improvement, it changes no props or types (only how the calendar sizes itself, noted under Breaking Changes in case there are external consumers), we can adjust it later if needed, and within Gutenberg the calendar is only used by DataForm/DataViews. |
|
I agree it's preferable to centering the calendar with large gutters on both sides. I suppose the other option would be to set the min-width on the popover content to I do tend to think the calendar should be a little more flexible in terms of width. Let's see what @WordPress/gutenberg-components thinks. |
| width: 100%; | ||
| min-width: calc(var(--wp-ui-calendar-cell-size) * 7); |
There was a problem hiding this comment.
With width: 100% on the table, its max-content width becomes the 48px cap. In any container sized to its content (a @wordpress/ui Popover, a flex row, an absolutely positioned wrapper), the calendar renders at 336px for one month and 688px for two, instead of 224px and 464px. Swapping the two values keeps the intrinsic size at the minimum and still fills a container with a definite width.
| width: 100%; | |
| min-width: calc(var(--wp-ui-calendar-cell-size) * 7); | |
| width: calc(var(--wp-ui-calendar-cell-size) * 7); | |
| min-width: 100%; |
I think this was the intent anyway, since the changelog says to use width: fit-content to keep the previous size, which is false unless we fix this part.
| // layout's popover (320px minus its padding), so it keeps the same size in | ||
| // every layout instead of growing to its maximum in wide forms. | ||
| .dataviews-controls__calendar { | ||
| width: 100%; |
There was a problem hiding this comment.
The calendar root is a block now, and the column Stack stretches it, so this isn't needed.
| width: 100%; |
|
I think the direction is correct, but I think that an even better approach is to make There are definitely a few challenges, especially about date range selection. I'm proposing an approach in #86086 |
|
I'm going to close this one in favor of Marco's (thanks!). |












What?
Alternative to #85830, following this suggestion. See #76076 (this comment).
Lets the
CalendarandRangeCalendarcomponents from@wordpress/uigrow to fill their container, with square days, instead of centering the calendar in DataForm panel popovers. In the post editor's Date popover, the calendar now spans the full width of the popover and lines up with the date input above it. DataForm keeps its calendars at that same size in every layout, so they don't grow to fill wide forms.Why?
The calendars have a fixed size: seven 32px columns. Most containers are wider (the DataForm panel popover is at least 320px), so the calendar sits against the start edge with all the spare width after it. The DataForm controls already ask for
width: 100%, but the calendar grid ignores it. Fixing it in the component solves it everywhere the calendar is used.How?
In
@wordpress/ui(packages/ui/src/calendar/style.module.css):display: flow-root) instead of an inline block, so it takes the width of its container.width: 100%andtable-layout: fixed, so the seven day columns share the available width equally. Day buttons fill their column.aspect-ratio: 1), growing from 32px up to 48px (336px per month). This keeps the dashed range preview, drawn on a square SVG, inside its cell.numberOfMonths, up to three) lay them out in an equal-column grid: side by side when there is room, wrapping on narrow screens, and a month that wraps onto its own row stays as wide as the others. Amonthclass name is passed to react-day-picker for this.--_wp-ui-calendar-max-cell-size).This changes the default size of the component for every consumer, so the CHANGELOG entry is under Breaking Changes. To keep the previous size, a consumer can place the calendar in a container sized to its content.
In
@wordpress/dataviews:datefield. It was already defined in the story but not shown in the panel, and it is the quickest way to check the calendar inside a DataForm panel popover.Open questions:
@wordpress/ui, and 288px the right calendar width in DataForm?@wordpress/ui, as here, or opt-in?Testing Instructions
numberOfMonthsto 2 or 3. The months sit side by side and wrap when the window is narrow; a wrapped month is as wide as the others. Select a start date and hover a later one: the dashed preview stays within its row.Testing Instructions for Keyboard
Only the calendar's size changes. Tab into the Date popover and use the arrow keys, Page Up, and Page Down to move between days and months to check the calendar still works as before.
Screenshots or screencast
Inspector
DataForm panel popover (Storybook, Layout Panel):
DataForm regular layout (Storybook, Layout Regular):
DataViews filter popover and a regular form side by side. The filter popover is narrower than 288px, so its calendar stays at the minimum size:
Date range filter popover with a selected range:
Use of AI Tools
This PR was written with Claude Code (Claude Opus 5.5), which made the change, checked it in Storybook, and ran the calendar and DataForm control unit tests. I reviewed the change and took the screenshots.