Repository navigation
Premium Analytics: pin the dashboard section header and condense it on scroll - #51232
Conversation
the page header leaves the scroll flow and stays pinned past one viewport
takes that header's fill and hairline, and isolates the grid layers below it
scoped to the dashboard: post detail and the report pages keep the tab bar margin
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Code Coverage SummaryThis PR did not change code coverage! That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷 |
the sections are links keyed by URL slug and belong in that slot, not in a tablist
subtitle row and title both follow a view timeline the surface publishes
a pin marker opens the range the moment the tabs are cleared, and the band tightens with it
without timeline support the 0s fallback froze the condensed state
chihsuan
left a comment
There was a problem hiding this comment.
Nice work! @retrofox I ran this locally and looks good.
Related to WOOA7S-1783: in the prototype the page subtitle (Views, visitors, and where they came from.) also hides as you scroll, so the whole top area collapses rather than just the section header. Might worth addressing in a follow-up.
This is going to be a tough one. The page subtitle is part of the admin-ui Page component. It doesn't support this feature afaik, and I wonder what the chances are of it being added. Even more, the PR introducing the Page navigation was merged a few days ago. This means that in the next release, we'll be able to replace the (bad, imo) custom navigation based on tabs with the Page |
Got it, thanks for the explanation. That makes sense. I think we can discuss later if there are any alternatives with Eder then 🙏 |
Where the date controls have travelledWith the revised design landing, it is worth writing down how this surface got here. Not to relitigate anything: the design converged through iteration, which is what iteration is for. But the code carries the marks of each step, and whoever reads it next deserves the map. The picker went full circleThe ported package (#49360) shipped the date picker as a dropdown of presets with "Custom" at the end. #50365 replaced it with the segmented row of pills trunk has today. The revised design returns it to a dropdown, modelled on Plausible, with the calendar appearing only on "Custom". #51835 adds that component and #51842 puts it on screen. Most of what followed served the pillsA pill row has to fit on one line in every locale, and that turned out to be most of the work:
Plus the abbreviated label variants and the CSS that picks between them (WOOA7S-1816, WOOA7S-1900), and the probe that measures the full-length row (WOOA7S-1837). A dropdown has one trigger and nothing to measure, so #51842 removes the measurement and WOOA7S-2029 takes out what is left behind. The subtitle, and this PR's condense#50897 put the applied date configuration in a subtitle under the title, and #51420 added the comparison's dates to it. This PR pinned the header and condensed it on scroll, and the condense's main move was fading that subtitle out: 190px of pinned chrome down to 146px. #51707 then removed the subtitle. The condense still runs, but all it has left is the title's font-size step, and the SCSS says so plainly: "Buys no height: the row is floored by the date controls beside it." The information the subtitle carried did not disappear, it moved onto the controls. #51817 puts the period on the trigger with the exact dates in a tooltip, and #51820 does the same for the comparison. What survivesWorth stating, because the above reads heavier than it is:
What goes is the pill row and the measurement around it. And an open question: whether a header with no subtitle still wants a condense at all. |
Proposed changes
On trunk, the dashboard scrolls in the boot stage, above
Page, and everything rides along: the section header with its date controls, the tabs, and eventually the page header itself.Page's header is sticky in@wordpress/admin-ui, but.pageisheight: 100%, one viewport tall, so against that outer scroll the header holds only for the first viewport and then slides off with it.With this PR, the section panel scrolls in its own container, under the page header:
How it works
The sections root is the section's scroll container, so the page header stays out of the scroll flow entirely and the sticky section header never runs out of containing block, however long the widget grid is.
The condensing is a CSS scroll-driven animation.
SectionHeaderhas a new opt-incondenseOnScrollprop, off by default. The component cannot know where it pins, since what it has to clear (the tab list) belongs to the route, so the route publishes a--section-header-pinview timeline from an invisible 40px marker at the top of the panel: the marker's top edge sits exactly where the header comes to rest, so the timeline'sexitphase opens the moment the header pins, and its height is how far the condense runs.timeline-scopeon the panel makes the timeline visible to the header.The whole effect is progressive enhancement, gated behind
@supports (animation-timeline: ...). Browsers without scroll-driven animations, surfaces that publish no timeline, andprefers-reduced-motionall keep the resting header. Pinning itself is plainposition: stickyand works everywhere.Notes for reviewers
isolation: isolateon the grid caps its layers (edit overlay, resize, the@dnd-kitdrag preview) below it.Page's navigation slot (Admin UI: Add Navigation component and Page navigation slot WordPress/gutenberg#79746), which@wordpress/admin-uidoes not ship yet. WOOA7S-1931 tracks the move.SectionHeadersurfaces (post detail, report pages) do not opt in, so they must look exactly as on trunk.Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
Go to Jetpack → Stats (Traffic section) with enough widgets to scroll past one viewport.
Screen.Recording.2026-08-14.at.12.13.02.AM.mov
Pinning
Condensing
Widgets
Date controls
Fallbacks and other surfaces
SectionHeaderbut do not opt in, so nothing should move or change color.