Link: Fix focus outline around the new-tab icon#77910
Conversation
The `.link-icon` is `inline-block` to scope the link underline to the text, but that also lets its line-height (inherited as ~1.5) push the parent anchor's line box taller around the arrow, making the focus outline noticeably taller on that side. Constraining the icon to `line-height: 1` keeps its box within the surrounding text's strut so the outline stays uniform without changing the markup. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
e2b237e to
2404f86
Compare
|
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. |
|
Size Change: +9 B (0%) Total Size: 7.87 MB 📦 View Changed
ℹ️ View Unchanged
|
mirka
left a comment
There was a problem hiding this comment.
Thanks for fixing 🙏
For posterity, common.css needs to be loaded for this to reproduce in Storybook.
|
Flaky tests detected in 2404f86. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/25314737567
|
|
@mirka Should we bolster the Global Defense styles to prevent this override, too? |
|
In this case, the issue was triggered by a 1.4 em line-height on |
Follow-up to #77420
What?
Fix the uneven focus outline rendered around
Linkcomponents whenopenInNewTabis enabled.Why?
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?
Add
line-height: 1to.link-iconso its box stays within the parent's strut.P.S. Separately from this PR, we also need to fix the focus outline for the
ExternalLinkcomponent. See #77790 (comment)Testing Instructions
Linkstory rendered withopenInNewTabset totrue.Screenshots or screencast
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 4.7
Used for: Diagnosing the root cause (inline-block line-box expansion) and proposing the one-line CSS fix. Final change reviewed and validated by me.