fix(analytics): give the date-range calendar its space, drop the dead panel width - #2047
Conversation
… panel width The shared date-range popover rendered nothing like the Figma "Analytics Final" flow: the calendar was squeezed to ~140px (19px-wide day cells, unreadable) while the preset list sat at ~400px, most of it blank, with the "Date Range" icon flung to the far edge. Cause: WP sizes `.components-popover__content` to `width: min-content`, and neither column was pinned. The preset list's min-content width is large (WP floors `.components-menu-item__item` at 160px), so the calendar absorbed every pixel of the shortfall and collapsed to its own min-content width. Both columns are now fixed and non-shrinking - calendar 312px (7 x 40px cells), presets 188px - so the popover width is deterministic wherever it renders, and the two panels read as separate rounded cards per Figma. Also: - day grid loses its column gap, so a selected range paints one continuous band - month grid renders only the weeks the month touches (a trailing all-next-month row was dead space; Figma shows five rows for a five-row month) - "Date Range" icon moves to the left of its label, as designed - hovering a selected endpoint no longer tints over it, which left the white day number unreadable - month steppers get the bordered square frame from the design One component, so every surface follows: dashboard viewers/insights/playback/top videos, per-video insights/retention/placements/layer timeline, and the woo Reel Pops section that borrows it through `window.GoDAM`.
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Adjusts the shared analytics DateRangePicker popover layout to match the Figma “Analytics Final” design by making the calendar/presets panels deterministic in width and refining the calendar grid rendering.
Changes:
- Refactors popover/panel SCSS to enforce fixed panel widths, update spacing, and improve range/hover visuals.
- Updates calendar grid generation to render only the weeks a month touches (instead of a fixed 6-row grid).
- Adds unit coverage for the new
monthGridbehavior and exports it for testing.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| pages/analytics/components/DateRangePicker/style.scss | Enforces fixed two-panel layout and updates calendar/preset styling to match design. |
| pages/analytics/components/DateRangePicker/index.js | Changes monthGrid sizing logic; adds popover class passthrough; adjusts toggle icon position; exports monthGrid. |
| pages/analytics/components/DateRangePicker/index.test.js | Adds parameterized tests for the new variable-week monthGrid. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The seven columns were `1fr` inside a border-box panel whose declared width left out the border, so each track resolved to 39.714px: the range band's edges landed on sub-pixel boundaries and the weekday labels drifted off their columns. Grid and weekday header now use fixed `repeat(7, 40px)` tracks, and the panel width carries padding plus border (314px). Measured live: every cell exactly 40.000px, offsets exact multiples of 40, weekday centres aligned to 0.000px.
Review — analytics date-range pickerReally solid fix. The root-cause writeup matches what the CSS actually does (WP's 1. Panel drop-shadows clip against the 4px popover padding. 2. Focus ring can be occluded by adjacent day cells. Dropping the grid column gap ( 3. Non-blocking observation: the variable row count means the calendar panel height now changes between 4/5/6-week months, so the popover reflows a little on month navigation. That's expected given the "only the weeks it touches" Figma goal — just flagging it's a behaviour change from the old fixed 42-cell height. Overall LGTM; the notes above are all optional. |
ReviewSolid, well-scoped fix — the correctness of the core change holds up. I verified the A few low-severity polish/robustness notes, all in
Nit: the PR description says "No markup, props, data-test-ids, or query behaviour changed," but the diff does add the Nothing here blocks merge; items 1–2 are the ones I'd address before shipping. |
What
The shared analytics date-range popover rendered nothing like the Figma Analytics Final flow. The calendar was squeezed to ~140px (19px-wide day cells, effectively unreadable) while the preset list sat at ~405px with most of it blank, the "Date Range" icon pushed to the far edge.
DateRangePickeris one component used on nine surfaces, so this fixes all of them at once.Why it happened
WP sizes
.components-popover__contenttowidth: min-content, and neither column in.godam-daterangewas pinned:The preset list's min-content width is large (WP floors
.components-menu-item__itemat 160px and pushes trailing icons out withmargin-right: auto), so withmin-contentsizing the calendar absorbed the whole shortfall and collapsed.What changed
Both columns are now fixed and non-shrinking, so the popover width is deterministic wherever it renders: calendar 314px, presets 188px, 8px apart as two rounded panels per the design. The day grid and weekday header run on fixed
repeat(7, 40px)tracks and the calendar width carries its padding plus border, so every cell lands on an exact pixel boundary (measured: cell offsets0, 40, 80 ... 240, weekday-centre delta0.000px). Fractional1frtracks put the range band's edges on sub-pixels, which shows as hairlines between adjacent days.Date Rangeicon moves to the left of its label, as designedNo markup, props, data-test-ids, or query behaviour changed. Accent colours still follow
--wp-admin-theme-color.Testing
Verified live on
godam-dev.local(Chrome, 1470px viewport) by opening every picker instance and measuring the rendered geometry. All ten report popover 518px / calendar 314px / presets 188px, no clipping and no scrollbars:The Reel Pops section picker is the
godam-for-wooconsumer that borrows this component throughwindow.GoDAM, so the cross-plugin path is covered by the same verification.Unit tests:
monthGridis now exported and covered for a 4-week month (Feb 2026), a 5-week month (Jul 2026) and a 6-week month (Aug 2026), plus an invariant that no month ends on a row of only next-month days. 12 tests pass;lint:jsandlint:cssclean.Automation impact
data-test-idhooks are unchanged (*-toggle,*-panel,*-preset-<key>,*-custom). Suites that assert a fixed 42 day cells need updating to the per-month week count.Screenshots