Link: Remove underline from unstyled icon links#77420
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. |
|
Size Change: 0 B Total Size: 7.75 MB ℹ️ View Unchanged
|
|
Flaky tests detected in 8e5804a. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/24561162565
|
|
I'm sure there were reasons, but the way we've implemented the component so that it has a different element structure applying the underline depending on Revisiting that implementation, I expect it was done the way it was to avoid the underline extending to the pseudo-element, and the screen reader reading pseudo-element content? Based on some light investigation and testing, maybe we can address that with a combination of |
|
@aduth Good idea, this is a lot cleaner. Confirmed working in Chrome/Safari/Firefox. |
* Fix unstyled link underline * Link: Simplify new tab icon rendering * Add changelog Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: ciampo <mciampini@git.wordpress.org> Co-authored-by: aduth <aduth@git.wordpress.org>

What?
Prevent the
unstyledLinkvariant from showing an underline whenopenInNewTabis enabled.Why?
The previous
openInNewTabmarkup wrapped the label in a.link-contentsspan that re-applied underline styles. That was correct for default and neutral links, but it forced underline onto the label even when the root anchor wasunstyled, which should not apply link chrome.How?
openInNewTabcontent in.link-contentsand drop the.has-link-iconclass on the anchor. Children are always a fragment: link text, then the optional new-tab icon..link-iconasinline-blockandtext-decoration: noneso the underline stays on the text for styled variants, and the decorative arrow does not pick up decoration. Theunstyledvariant keepstext-decoration: noneon the anchor as before.toBeVisible, link accessible name includes the “opens in a new tab” phrase).Testing Instructions
Linkwithvariant="unstyled"andopenInNewTabset totrue.LinkwithopenInNewTabset totrue.Screenshots