ExternalLink: Fix focus outline under wp-admin#77935
Conversation
The wp-admin `common.css` applies `box-shadow` and `border-radius` to focused links, which clashes with the design system focus outline on `ExternalLink`. Override these so the focus indicator renders correctly within wp-admin. Also set `line-height: 1` on the new-tab icon to keep the outline tight around the link content. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Size Change: +27 B (0%) Total Size: 7.94 MB 📦 View Changed
ℹ️ View Unchanged
|
|
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. |
|
Flaky tests detected in ae1165c. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/25377503986
|
Related to #77910
See #77790 (comment)
What?
Fix the focus outline rendered around the
ExternalLinkcomponent when used inside wp-admin.Why?
#77790 applied a new focus style to the
ExternalLinkcomponent via theoutlineproperty, based on the new design system. However, w-admin appliesbox-shadowandborder-radiusto theaelement, which prevents the focus ring from being formed correctly.Additionally, the link icon has
display:inline-block, which may cause the resulting inline block box to be taller than the surrounding text's baseline.How?
box-shadowandborder-radiusin the focus state so only the design-system outline is shown.line-height: 1to.components-external-link__iconso the icon's inline box stays within the surrounding strut.Testing Instructions
ExternalLink(for example, insert a block, open the Advanced panel, and focus the "Learn more about anchors" link).Screenshots or screencast
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 4.7
Used for: Diagnosing the wp-admin
common.cssoverrides and drafting the CSS fix. Final change reviewed and validated by me.