Skip to content

Commit ac0427b

Browse files
CGastrellclaude
andauthored
Admin pages: honor WP.com nav-unification 272px sidebar width (#48182)
The jetpack-admin-page-layout mixin hardcodes a 160px sidebar at expanded widths. On the WP.com wp-admin (body.is-nav-unification) the sidebar is actually 272px, so the pinned content column started 112px inside the sidebar and extended past the viewport on the right, visibly cropping Newsletter, Social, Search, etc. when accessed from WP.com. Below the auto-fold breakpoint (<= 960px) the sidebar narrows to 36px on both surfaces, and .folded always wins at 36px, so only the expanded-default state needs adjusting. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b119d94 commit ac0427b

2 files changed

Lines changed: 25 additions & 2 deletions

File tree

projects/js-packages/base-styles/admin-page-layout.scss

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@
3737
// runtime and there's no need to pay the custom-property indirection.
3838

3939
// wp-admin chrome constants (see wp-admin.css).
40-
$jp-sidebar-width-expanded: 160px; // default sidebar
41-
$jp-sidebar-width-folded: 36px; // .folded preference OR .auto-fold class
40+
$jp-sidebar-width-expanded: 160px; // default sidebar
41+
$jp-sidebar-width-folded: 36px; // .folded preference OR .auto-fold class
42+
$jp-sidebar-width-nav-unification: 272px; // body.is-nav-unification (WP.com wp-admin)
4243
$jp-admin-bar-height-desktop: 32px;
4344
$jp-admin-bar-height-mobile: 46px;
4445

@@ -48,6 +49,9 @@ $jp-admin-bar-height-mobile: 46px;
4849
// We mirror these breakpoints because WP's body-class state is not always
4950
// in sync with the rendered viewport (the `auto-fold` class can stay stale
5051
// after a narrow → wide window resize).
52+
// WP.com's "nav-unification" (body.is-nav-unification) keeps the sidebar at
53+
// 272px above the auto-fold breakpoint; below 960px it narrows to 36px like
54+
// vanilla wp-admin, and below 782px it goes off-canvas.
5155
$jp-breakpoint-auto-fold: 960px;
5256
$jp-breakpoint-mobile: 782px;
5357

@@ -112,6 +116,21 @@ $jp-breakpoint-mobile: 782px;
112116
}
113117
}
114118

119+
// WP.com's wp-admin sets `body.is-nav-unification` and renders a 272px
120+
// sidebar (instead of wp-admin's default 160px) at expanded widths.
121+
// Below the auto-fold breakpoint the sidebar narrows to 36px like
122+
// vanilla wp-admin (core's `.auto-fold` rule wins by higher specificity),
123+
// and `.folded` (user preference) always narrows to 36px — both of those
124+
// cases are already covered above. The only state that needs adjusting
125+
// is the expanded default at ≥ 961px. The `:not(.folded)` guard lets
126+
// the `.folded` rule keep winning at wide widths on nav-unification too.
127+
@media (min-width: #{$jp-breakpoint-auto-fold + 1px}) {
128+
129+
&.is-nav-unification:not(.folded) #wpbody-content {
130+
left: $jp-sidebar-width-nav-unification;
131+
}
132+
}
133+
115134
// Every ancestor of <AdminPage> inside #wpbody-content must participate
116135
// in the flex chain, or the column collapses at the first non-flex
117136
// wrapper. Some pages mount their React tree with an extra wrapper in
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: fixed
3+
4+
admin-page-layout: honor WP.com nav-unification's 272px sidebar width at expanded viewports so the content column aligns with the visible sidebar instead of leaving a 112px gap.

0 commit comments

Comments
 (0)