Skip to content

fix(admin-ui): reset the wp-admin li margin that misaligns Breadcrumbs - #81134

Merged
chihsuan merged 1 commit into
trunkfrom
fix/admin-ui-breadcrumbs-li-margin
Aug 5, 2026
Merged

fix(admin-ui): reset the wp-admin li margin that misaligns Breadcrumbs#81134
chihsuan merged 1 commit into
trunkfrom
fix/admin-ui-breadcrumbs-li-margin

Conversation

@chihsuan

@chihsuan chihsuan commented Aug 4, 2026

Copy link
Copy Markdown
Member

What?

Resets the margin on the list items Breadcrumbs renders, so wp-admin's global list styling stops pushing the trail out of alignment with the rest of the page header.

Why?

wp-admin's common.css sets dd, li { margin-bottom: 6px }. That reaches the <li> elements Breadcrumbs renders, so the trail's <ul> measures 6px taller than the text inside it. Page's header centres its children, so the trail ends up sitting 3px above everything it shares the row with.

Breadcrumbs already resets margin on the list itself; only the items' margin was missing.

This is not visible in Storybook, because Storybook does not load wp-admin's stylesheets. It only shows up on a real admin page, which is likely why it has gone unnoticed.

How?

Adds margin: 0 to the existing .list > li rule.

The @wordpress/ui global CSS defense module is deliberately not used here. It exists because that package's styles live in a cascade layer and therefore lose to wp-admin's unlayered bare-element selectors. @wordpress/admin-ui has no @layer, so .list > li (0,1,1) already outranks dd, li (0,0,1) on specificity alone β€” and #80952 proposes forbidding the defense tokens outside the UI package. If #77039 moves Breadcrumb into @wordpress/ui, this line should become an --_gcd-li-margin token at that point.

Testing Instructions

  1. Enable the Content Types experiment: Settings β†’ Gutenberg β†’ Content Types.
  2. Go to Settings β†’ Content Types β†’ Add post type.
  3. The header shows the trail Post Types / Add new with a Create button on the right. Check that the heading text is vertically centred against the button.

On trunk the heading sits 3px high. Measured on the same page:

ul height Add new centre Create centre delta
Before 30px y = 61 y = 64 βˆ’3px
After 24px y = 64 y = 64 0

The same misalignment appears on Settings β†’ Content Types β†’ Taxonomies β†’ (any taxonomy), which uses the same header.

Testing Instructions for Keyboard

No interaction changes.

Screenshots or screencast

Before After
Screenshot 2026-08-04 at 3 09 10β€―PM Screenshot 2026-08-04 at 3 14 35β€―PM

Use of AI Tools

This PR was authored with Claude Code. AI was used to trace the cause, to write the change and the changelog entry, and to draft this description.

@chihsuan chihsuan self-assigned this Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: chihsuan <chihsuan@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@chihsuan
chihsuan requested review from louwie17, mirka and retrofox and removed request for louwie17 August 4, 2026 07:21
wp-admin's `dd, li { margin-bottom: 6px }` (common.css) reaches the list
items `Breadcrumbs` renders, so the trail measures 6px taller than its
text. The page header centres that taller box, which leaves the trail
sitting 3px above everything it shares the row with.

Reproduced on Settings > Content Types > Add post type, where the "Add
new" heading sits at y=61 against the Create button's y=64. Resetting the
item margin brings both to y=64.

The list's own margin was already reset; only its items' was missing.
Storybook does not load wp-admin's stylesheets, so no story shows this.
@chihsuan
chihsuan force-pushed the fix/admin-ui-breadcrumbs-li-margin branch from e0da4dc to eb46f43 Compare August 4, 2026 07:24
@chihsuan chihsuan added the [Type] Bug An existing feature does not function as intended label Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Size Change: -17 B (0%)

Total Size: 7.78 MB

πŸ“¦ View Changed
Filename Size Change
build/modules/content-types/index.min.js 166 kB -17 B (-0.01%)

compressed-size-action

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Flaky tests detected in eb46f43.
Some 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.

πŸ” Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/30887659534
πŸ“ Reported issues:

@mirka mirka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good πŸ‘

@chihsuan
chihsuan merged commit 7a1e659 into trunk Aug 5, 2026
65 checks passed
@chihsuan
chihsuan deleted the fix/admin-ui-breadcrumbs-li-margin branch August 5, 2026 02:02
@github-actions github-actions Bot added this to the Gutenberg 23.8 milestone Aug 5, 2026
@sirreal sirreal added the [Package] Admin UI /packages/admin-ui label Aug 12, 2026
shail-mehta pushed a commit that referenced this pull request Aug 12, 2026
#81134)

wp-admin's `dd, li { margin-bottom: 6px }` (common.css) reaches the list
items `Breadcrumbs` renders, so the trail measures 6px taller than its
text. The page header centres that taller box, which leaves the trail
sitting 3px above everything it shares the row with.

Reproduced on Settings > Content Types > Add post type, where the "Add
new" heading sits at y=61 against the Create button's y=64. Resetting the
item margin brings both to y=64.

The list's own margin was already reset; only its items' was missing.
Storybook does not load wp-admin's stylesheets, so no story shows this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Admin UI /packages/admin-ui [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants