Repository navigation
Conversation
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
🤖 PR meta 🤖📦 Bundle sizeSize Change: +1.74 kB (+0.02%) Total Size: 8.01 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
|
`Link`'s default variant never declared an underline. It tuned
`text-underline-offset`, `text-decoration-thickness` and
`text-decoration-color` and relied on the user agent underline, so an
unlayered host rule such as `.plugin-admin-page a { text-decoration: none; }`
removed the underline and left the tuning styling nothing.
Defend `text-decoration-line`, `text-decoration-color` and
`text-decoration-thickness` on the `.a` global CSS defense, and bridge
`Link`'s own values into them. All three longhands are needed because a host
`text-decoration` shorthand resets each of them.
The new block is scoped to `:any-link`. The existing `.a` block is `(0,1,0)`,
which beats wp-admin's bare `a` selectors but loses to the wrapper-scoped
`.some-page a` rules that strip underlines in practice. `:any-link` raises it
to `(0,2,0)` and matches only the elements that carry a user agent underline.
Fallbacks are the initial values, so `Link` `unstyled`, `LinkButton` and
`Menu.LinkItem` need no override and nothing renders differently on a page
with no hostile global CSS.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ae9911f to
1ef3f20
Compare
|
I'm afraid the global CSS defense module is only for wp-admin's unlayered Overscoped rules like And even if we were to try addressing this in the global CSS defense module as proposed, it would mean that the style would now win over any I agree that |
…se (#52404) The underline workaround said WordPress/gutenberg#82620 would narrow it. That PR's defense only covers wp-admin's own unlayered styles, not plugin rules like `.jetpack-pagestyles a`, so nothing upstream will retire this. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
…se (#52404) The underline workaround said WordPress/gutenberg#82620 would narrow it. That PR's defense only covers wp-admin's own unlayered styles, not plugin rules like `.jetpack-pagestyles a`, so nothing upstream will retire this. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/35133303437 Upstream-Ref: Automattic/jetpack@8d1d0f6
|
Closing for clean up. |
What?
Adds a
text-decorationbridge to@wordpress/ui's global CSS defense, so aLink's underline survives host pages that strip anchor underlines.Why?
Link'sdefaultvariant never declared an underline — it tunes offset, thickness and colour and relies on the UA underline. An unlayered host rule like.some-admin-page a { text-decoration: none; }therefore removes it outright and leaves the tuning styling nothing.global-css-defense.module.cssalready bridgesoutline,color,box-shadow,border-radiusandtransitionfor this reason;text-decorationwas missing because wp-admin's own CSS never touches it.The concrete case is the Jetpack plugin, which sets exactly that rule on every admin screen. It's the only one I can point to, but the shape is generic.
How?
A new
.a:any-linkblock defends the threetext-decorationlonghands, with the initial values as fallbacks — so the defense alone changes nothing, and components opt in through the custom properties.Linkbridges its values in ondefault/neutral.Linkunstyled,LinkButtonandMenu.LinkItemneed no override.Two things worth flagging:
text-decorationshorthand resets colour and thickness too. Defending only the line restores an underline in the wrong colour and weight.:any-linkis a specificity increase,(0,1,0)→(0,2,0). The existing.abeats wp-admin's bareaselectors but loses to the wrapper-scoped.some-page arules hosts actually write. The cost: a consumer styling a wp-ui link from outside at(0,1,0)will now lose and would need to set--_gcd-a-text-decoration-line. Keeping plain.aspecificity avoids that but fixes nothing. Happy to take the other trade if preferred.Testing Instructions
Linkon a page that also loads an unlayered.wrap a { text-decoration: none; }. Ontrunkthe underline is gone; on this branch it's restored, withfrom-fontthickness and the neutral stroke colour.Link(both tones and variants),LinkButtonandMenu.LinkItemare unchanged fromtrunk. This is the important check.Testing Instructions for Keyboard
No interaction change. Tab to a
Linkand confirm the focus ring behaves as ontrunk.Screenshots or screencast
A
Notice.ActionLink(aLink,tone="neutral",variant="default") on a page carrying.jetpack-pagestyles a { text-decoration: none; }.Computed styles on that element:
text-decoration-linenoneunderlinetext-decoration-thicknessautofrom-fonttext-decoration-colorrgb(30, 30, 30)(currentColor)rgb(141, 141, 141)(--wpds-color-stroke-interactive-neutral)The host page runs the published
@wordpress/ui, so the "after" is this PR's CSS injected with the built module hashes substituted, declarations otherwise verbatim.Use of AI Tools
Researched and drafted with Claude Code, reviewed by me before submission. The cascade behaviour, specificity comparison and three-longhand requirement were each verified in a browser across trunk/branch × clean/hostile CSS, rather than reasoned about on paper.