Skip to content

Base styles: Fix admin-page-layout header selector for admin-ui 2.1#49006

Merged
CGastrell merged 2 commits into
trunkfrom
fix/admin-page-layout-header-selector
May 20, 2026
Merged

Base styles: Fix admin-page-layout header selector for admin-ui 2.1#49006
CGastrell merged 2 commits into
trunkfrom
fix/admin-page-layout-header-selector

Conversation

@CGastrell
Copy link
Copy Markdown
Contributor

Fixes header growing to fill the flex column on dashboards that adopted the shared jetpack-admin-page-layout mixin once @wordpress/admin-ui bumps to 2.1.x.

Proposed changes

  • Update admin-page-layout.scss's two header-anchoring selectors from .jp-admin-page__page > header to .jp-admin-page__page > :first-child.
  • Update the inline comment to document the new anchor and the upstream change it adapts to.

Why

@wordpress/admin-ui 2.0.x rendered the <Page>'s header as a <header> element (via render={ <header /> } on the Stack). 2.1.0 removed that render prop — see Gutenberg PR WordPress/gutenberg#78001 ("Fix nested landmark in header") — so the header is now a plain <div>. Verified locally against both versions resolved under node_modules/.pnpm/:

  • @wordpress/admin-ui@2.0.0src/page/header.tsx line 36: render={ <header /> }
  • @wordpress/admin-ui@2.1.0src/page/header.tsx line 58: no header render prop on the outer Stack

With the element change, our > header selector silently stops matching: the header loses flex-shrink: 0 and grows to fill the flex column, and the tabs-strip flush-fit rule stops firing too.

Why :first-child

admin-ui's <Page> always renders <Header> as the first child of the page wrapper (src/page/index.tsx). > :first-child is therefore stable across element changes inside <Header>'s render tree and works for both 2.0 (<header>) and 2.1+ (<div>). The CSS-Modules class hash on the new wrapper is not selector-stable, so structural selection is the only forward-compatible option.

Context

This surfaced via Renovate PR #48404 (bundled @wordpress/* bump to 2.1.x). Without this change, dashboards using <AdminPage> (VideoPress, Search, Newsletter, Protect, etc.) show a header that grows to fill the flex column once they pull admin-ui 2.1+.

Related product discussion/links

Does this pull request change what data or activity we track or use?

No.

Testing instructions

This is an SCSS-only change in a shared mixin. To verify functionally:

  1. On a Jetpack environment with @wordpress/admin-ui@2.1.x installed, build a consumer of the mixin — for example:
    pnpm jetpack build packages/videopress packages/search
    
  2. Open a dashboard that uses <AdminPage> (e.g. VideoPress, Search, Newsletter, Protect).
  3. Before this change: the page header grows to fill the available flex column height. After this change: the header is pinned at its natural height at the top of the column, and the scrollable middle takes the remaining space (matching admin-ui 2.0 behaviour).
  4. Repeat the check on a Jetpack environment still on @wordpress/admin-ui@2.0.x (e.g. trunk pre-Renovate) — the layout should be identical to before (> :first-child matches the <header> element just like > header did).
  5. On a dashboard with a tabs strip (e.g. VideoPress), confirm the tabs strip still sits flush against the page header (the :has(.jp-admin-page-tabs) > :first-child rule still applies its border-bottom: none; padding-bottom: 0).

@wordpress/admin-ui 2.1.0 (Gutenberg PR WordPress/gutenberg#78001)
removed render={ <header /> } from the Page header's Stack, so the
rendered element changed from <header> to <div>. The mixin's
> header selectors silently stopped matching and the header was no
longer pinned at the top of the flex column.

Anchor to > :first-child instead — Page always renders its Header
as the first child of the page wrapper, regardless of element type.
Forward-compatible with 2.1+ and backward-compatible with 2.0.
@CGastrell CGastrell added [Status] In Progress [JS Package] Base Styles [Status] UI Changes Add this to PRs that change the UI so documentation can be updated. labels May 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 20, 2026

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the fix/admin-page-layout-header-selector branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack fix/admin-page-layout-header-selector
bin/jetpack-downloader test jetpack-mu-wpcom-plugin fix/admin-page-layout-header-selector

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions Bot added the RNA label May 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

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:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@CGastrell CGastrell self-assigned this May 20, 2026
@jp-launch-control
Copy link
Copy Markdown

jp-launch-control Bot commented May 20, 2026

Code Coverage Summary

This 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. 🤷

Full summary · PHP report · JS report

…lable-middle selector

Mirrors the selector change in 8e4d22a onto the `:not(header)` companion rule. Same upstream cause — admin-ui 2.1 renders the page header as a `<div>` instead of `<header>`, so position-based selectors are required to keep the scrollable-middle partition correct.
@CGastrell CGastrell marked this pull request as ready for review May 20, 2026 15:25
@CGastrell CGastrell merged commit e17ffe2 into trunk May 20, 2026
92 checks passed
@CGastrell CGastrell deleted the fix/admin-page-layout-header-selector branch May 20, 2026 17:59
CGastrell added a commit that referenced this pull request May 22, 2026
Replace the three `> header` selectors in the AdminPage SCSS module
with `> :first-child` so they keep matching after @wordpress/admin-ui
2.1 changed the page header element from <header> to <div>.

Together with #49006 (which applied the same fix to the shared
admin-page-layout mixin in js-packages/base-styles), this resolves the
publicize page header spacing regression that surfaced on PR #48404 —
the title/subtitle ' compaction' was the cumulative effect of the three
jetpack-side overrides (sticky-disable, border removal, visual-slot
centering) silently ceasing to fire, not a missing gap.

Also bumps @wordpress/admin-ui from 2.0.0 to 2.1.0 in this package as
the consumer-side pin of the version this fix targets.
CGastrell added a commit that referenced this pull request May 22, 2026
….1 (#49018)

* Components: fix AdminPage SCSS module header selectors for admin-ui 2.1

Replace the three `> header` selectors in the AdminPage SCSS module
with `> :first-child` so they keep matching after @wordpress/admin-ui
2.1 changed the page header element from <header> to <div>.

Together with #49006 (which applied the same fix to the shared
admin-page-layout mixin in js-packages/base-styles), this resolves the
publicize page header spacing regression that surfaced on PR #48404 —
the title/subtitle ' compaction' was the cumulative effect of the three
jetpack-side overrides (sticky-disable, border removal, visual-slot
centering) silently ceasing to fire, not a missing gap.

Also bumps @wordpress/admin-ui from 2.0.0 to 2.1.0 in this package as
the consumer-side pin of the version this fix targets.

* Search e2e: adapt header-logo locator to admin-ui 2.1's <div> page header

The dashboard test was scoping the Jetpack Logo locator via
`page.locator( 'header' )` — coupling to admin-ui 2.0's <header>
element. admin-ui 2.1 renders the page header as a <div>
(WordPress/gutenberg#78001), so the locator finds nothing once this
PR's admin-ui pin lands.

Swap the locator to `.jp-admin-page__page > :first-child` — same
positional pattern this PR uses in the SCSS module, matches both the
old <header> and the new <div>. Updates the surrounding comment to
explain the choice.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[JS Package] Base Styles RNA [Status] UI Changes Add this to PRs that change the UI so documentation can be updated.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant