Skip to content

Link: Draw the neutral underline in the text color - #87428

Open
ciampo wants to merge 5 commits into
trunkfrom
extract/link-interaction-colors-82294
Open

ciampo wants to merge 5 commits into
trunkfrom
extract/link-interaction-colors-82294

Conversation

@ciampo

@ciampo ciampo commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Extracted from #82294. This change can land on trunk independently.

What?

Neutral Link underlines take the text color.

Why?

A neutral link draws its underline in a gray stroke color (#8b8b8b), which is fainter than its text (#1e1e1e). A default hypertext underline matches the text color. Neutral links share the color of the surrounding text, so the underline is the only thing that marks them as links.

How?

The Link underline uses currentColor, and the neutral tone no longer overrides it. Brand links already drew the underline in the text color, so they don't change. Underline thickness, hover, and focus styles stay as on trunk, and ExternalLink is unchanged.

After review, this PR no longer makes the underline thicker on hover and press.

Testing Instructions

Open Link → Inline in Storybook and select the neutral tone. Check that the underline has the same color as the link text. On trunk, the underline is a lighter gray. Hover the link and check that the underline doesn't change.

Testing Instructions for Keyboard

Tab to the link. Check that it shows the focus ring, as on trunk.

Screenshots

Neutral inline Link in Link → Inline, at rest. Hover looks the same as rest on both trunk and this branch.

Before After
Neutral Link on trunk, with a gray underline Neutral Link with an underline in the text color

Use of AI Tools

OpenAI Codex extracted the changes from #82294 and ran the checks. Claude Code reduced the scope after review, captured the screenshots, and updated this description.

🤖 Generated with Claude Code

@github-actions github-actions Bot added [Package] Components /packages/components [Package] UI /packages/ui labels Nov 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground Preview in Storybook

🎉 Props

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: ciampo <mciampini@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: jameskoster <jameskoster@git.wordpress.org>

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


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub or WordPress.org user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

📦 Bundle size

Size Change: -30 B (0%)

Total Size: 8.86 MB

📦 View Changed
Filename Size Change
build/modules/boot/index.min.js 54.9 kB +4 B (+0.01%)
build/modules/core-fields/attachment.min.js 43.9 kB -13 B (-0.03%)
build/modules/core-fields/post_type_supports.min.js 87.7 kB +2 B (0%)
build/scripts/block-directory/index.min.js 42.3 kB -6 B (-0.01%)
build/scripts/block-editor/index.min.js 563 kB -2 B (0%)
build/scripts/block-library/index.min.js 433 kB -11 B (0%)
build/scripts/edit-site/index.min.js 377 kB -1 B (0%)
build/scripts/editor/index.min.js 579 kB -3 B (0%)
build/scripts/format-library/index.min.js 73.8 kB +3 B (0%)
build/scripts/media-utils/index.min.js 235 kB -4 B (0%)
build/scripts/notices/index.min.js 47.6 kB +1 B (0%)

8a17ef2 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric aa864fc trunk % Change
timeToFirstByte 48.1 ms +15.7% -3.43% 49.3 ms +18.66% -3.96% -2.43%
largestContentfulPaint 78 ms +12.82% -7.69% 78 ms +10.26% -5.13% 0%
lcpMinusTtfb 26.35 ms +28.46% -5.69% 27.1 ms +14.76% -14.58% -2.77%
wpBeforeTemplate 24.53 ms +18.51% -1.71% 25.15 ms +18.37% -1.71% -2.47%
wpTemplate 19.79 ms +7.43% -4.45% 20.33 ms +9.2% -5.71% -2.66%
wpTotal 44.61 ms +15.74% -4.06% 45.41 ms +20.22% -3.81% -1.76%
wpMemoryUsage 7.76 MB +0% -0% 7.72 MB +0% -0% 0.45%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric aa864fc trunk % Change
timeToFirstByte 39.75 ms +9.06% -6.04% 40.45 ms +5.69% -3.46% -1.73%
largestContentfulPaint 70 ms +5.71% -2.86% 68 ms +5.88% -0% 2.94%
lcpMinusTtfb 30.6 ms +4.58% -5.39% 29.35 ms +4.43% -2.39% 4.26%
wpBeforeTemplate 21.78 ms +11.07% -3.95% 21.81 ms +2.8% -2.11% -0.14%
wpTemplate 14.66 ms +10.3% -5.32% 15.08 ms +11.14% -3.25% -2.79%
wpTotal 36.74 ms +8.27% -6.18% 37.46 ms +4.67% -3.55% -1.92%
wpMemoryUsage 6.44 MB +0% -0% 6.41 MB +0% -0% 0.56%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric aa864fc trunk % Change
mediaProcessingJpeg 330.04 ms +1.68% -0.44% 335.71 ms +0.12% -1.3% -1.69%
mediaProcessingAvif 4921.77 ms +0.64% -0.41% 4903.45 ms +0.55% -0.38% 0.37%
mediaProcessingJpegToAvif 3421.91 ms +0.08% -0.26% 3425.42 ms +0.33% -0.38% -0.1%

media-upload

Metric aa864fc trunk % Change
jpegUploadProcessing 1502.39 ms +1.14% -0.7% 1463.17 ms +0.91% -1.04% 2.68%
pngUploadProcessing 254.87 ms +8.87% -4.07% 249.69 ms +4.28% -2.98% 2.07%
largeJpegUploadProcessing 1449.23 ms +1.24% -0.18% 1451.97 ms +0.54% -0.79% -0.19%
multipleImageUploadProcessing 1617.51 ms +1% -1.81% 1598.01 ms +3.21% -1.4% 1.22%

post-editor

Metric aa864fc trunk % Change
serverResponse 328.86 ms +5.11% -4.25% 336.21 ms +2.16% -5.88% -2.19%
firstPaint 306.82 ms +10.57% -5.31% 340.82 ms +5.72% -8.4% -9.98%
domContentLoaded 669.43 ms +3.39% -0.24% 654.01 ms +3.28% -1% 2.36%
loaded 670.48 ms +3.36% -0.25% 654.98 ms +3.26% -0.99% 2.37%
firstContentfulPaint 375.73 ms +4.56% -0.81% 361.13 ms +5.87% -1.22% 4.04%
firstBlock 1752.52 ms +1.63% -0.65% 1679.88 ms +1.63% -0.73% 4.32%
type 15.38 ms +5.66% -9.1% 15.41 ms +8.76% -3.63% -0.19%
typeWithoutInspector 15.61 ms +3.4% -13.84% 15.07 ms +4.31% -8.29% 3.58%
typeWithTopToolbar 20.23 ms +3.26% -2.87% 19.42 ms +4.79% -7.36% 4.17%
typeContainer 7.35 ms +9.25% -2.59% 7.25 ms +17.1% -3.03% 1.38%
focus 87.45 ms +1.43% -6.66% 84.47 ms +6.59% -1.1% 3.53%
firstFocus 202.5 ms +0% -0% 210.55 ms +0% -0% -3.82%
selectAll 278.27 ms +4.05% -1.07% 273.54 ms +3.81% -1.36% 1.73%
undo 23.05 ms +5.81% -3.9% 22.69 ms +6.43% -3.39% 1.59%
listViewOpen 31.5 ms +7.43% -2.25% 32.45 ms +8.88% -6.38% -2.93%
inserterOpen 33.07 ms +14.85% -4.54% 33.28 ms +4.66% -5.83% -0.63%
inserterHover 9.08 ms +6.17% -8.37% 8.94 ms +11.52% -10.63% 1.57%
inserterSearch 7.33 ms +6% -7.64% 7.14 ms +5.46% -7.7% 2.66%
loadPatterns 543.26 ms +1.04% -6.14% 536.35 ms +2.63% -2.18% 1.29%
wpTotal 320.51 ms +5.24% -4.37% 328.01 ms +2.16% -6.54% -2.29%
wpMemoryUsage 14.80 MB +0% -0% 14.76 MB +0% -0% 0.25%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric aa864fc trunk % Change
serverResponse 387.37 ms +0.85% -6.35% 396.95 ms +1.43% -1.13% -2.41%
firstPaint 438.17 ms +2.92% -17.98% 443.53 ms +2.94% -12.77% -1.21%
domContentLoaded 804.63 ms +1.11% -1.02% 814.64 ms +0.71% -1.72% -1.23%
loaded 805.72 ms +1.12% -1% 815.72 ms +0.73% -1.72% -1.23%
firstContentfulPaint 448.83 ms +1.36% -1.99% 449.5 ms +1.73% -1.85% -0.15%
firstBlock 2362.29 ms +6.44% -0.5% 2370.63 ms +1.58% -0.54% -0.35%
type 17.45 ms +2.35% -11% 17.77 ms +3.55% -13.17% -1.8%
navigate 105.99 ms +8.64% -6.13% 106.02 ms +4.74% -2.72% -0.03%
loadPatterns 1522.48 ms +8.39% -0.88% 1478.47 ms +2.59% -14.8% 2.98%
loadPages 934.89 ms +1.13% -2.71% 928.63 ms +0.38% -1.11% 0.67%
wpTotal 377.91 ms +0.97% -6.55% 387.45 ms +1.44% -1.2% -2.46%
wpMemoryUsage 12.84 MB +0% -0% 12.80 MB +0% -0% 0.28%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

8a17ef2 Run

🏁 Flaky tests

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.

Navigates the items list via UP/DOWN arrow keys in /test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeFocused() failed

Locator:  getByLabel('Page Two')
Expected: focused
Received: inactive
Timeout:  5000ms

Call log:
  - Expect "toBeFocused" getByLabel('Page Two') with timeout 5000ms
  - waiting for getByLabel('Page Two')
    14 × locator resolved to <button type="button" tabindex="-1" aria-pressed="false" id="view-list-0-206-item-wrapper" class="dataviews-view-list__item" aria-labelledby="view-list-0-206-label" aria-describedby="view-list-0-206-description"></button>
       - unexpected value "inactive"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js:146:49

8a17ef2 Run

@ciampo ciampo self-assigned this Nov 26, 2026
@ciampo ciampo added the [Type] Enhancement A suggestion for improvement. label Nov 26, 2026
@ciampo
ciampo marked this pull request as ready for review November 26, 2026 08:29
@ciampo
ciampo requested a review from a team as a code owner November 26, 2026 08:29
@github-actions
github-actions Bot requested a review from aduth November 26, 2026 08:30
@ciampo
ciampo requested a review from a team December 2, 2026 09:29
@jasmussen

Copy link
Copy Markdown
Contributor

This is not a strong opinion on my end, but I'm not thrilled about changing the underline in any way at all. It feels like such a core hypertext element that even subtle changes to how default hypertext works, feels like an antipattern. I know we have tokens for hover and active, but I don't think we have to use them, and for things like "Link" and "ExternalLink", it feels like a use case where we don't do anything here.

If I'm the only one pushing back, you can ignore me, but I ask this: let's not do changes just because we can, let's do changes because they actually result in meaningful changes. In this case, Hypertext is old enough now that it's hard to beat, I don't think this beats it.

If you all feel strongly about this, however, the one thing I'd push back a bit more strongly on, is changing the underline on focus. If we have to make changes, centre them around hover and active—focus is not yet an intention of interaction, it's just an indicator of "where am I?"

The focus ring already marks keyboard focus, so focus no longer takes the hover color or the thicker underline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ciampo

ciampo commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks Joen, that's fair. The PR makes two separate changes that IMO we should first consider separately.

1. Underline color. Neutral links currently draw their underline in a separate gray (#8b8b8b) rather than the text color (#1e1e1e). A default hypertext underline takes the text color, so this change brings Link closer to plain hypertext, not further from it. It matters most for neutral links, since they share the color of the surrounding text and the underline is the only thing that marks them as links.

Trunk currentColor underline
Neutral Link at rest on trunk, with a gray underline Neutral Link at rest with an underline in the text color

2. Thicker underline on hover. On trunk, a neutral link gives no visual feedback on hover apart from the pointer cursor, because its resting and hover colors are the same (#1e1e1e). Brand links do change color. Many sites add an underline on hover, but Link already has one at rest, so that option isn't available. A thicker underline is the cue we have left that doesn't rely on color. You could argue the pointer cursor is enough, and I'm open to that.

Here's the hover state with and without the color change from (1):

Underline color Hover on trunk Hover with a thicker underline
Gray (trunk) Neutral Link on hover on trunk, with a thin gray underline Neutral Link on hover with a thicker gray underline
Text color Neutral Link on hover with a thin underline in the text color Neutral Link on hover with a thicker underline in the text color

The underline goes from 1px to 2px, which is the smallest visible step. I tried 1.5px, and it renders the same as 2px.

You're right about focus, so I've removed the focus changes. Keyboard focus now looks the same as on trunk: the focus ring shows where you are, without the hover color or the thicker underline.

Because the underline now uses currentColor, it follows every change to the text color. #82294 reworks the color ramps so that neutral text gets a separate hover color (#464646 at rest, #141414 on hover). If it lands, the text and the underline will darken together on hover. That could be enough of a cue without the thicker underline. But #82294 is still under discussion, so we can't count on it yet.

So my proposal: the underline color is arguably a fix, so I'd keep it. The thicker underline on hover is optional, and I'm fine dropping it, especially if #82294 lands. What do you think?

@mirka

mirka commented Dec 3, 2026

Copy link
Copy Markdown
Member

I do find the thicker underline to be a bit much, in the sense that it isn't visually pleasing to me. Or rather, that thickness could look good in certain design contexts, but I don't feel like it matches our neutral look and feel. I would prefer not changing the thickness if that's possible. Like you suggest, I think just the cursor changing is probably fine?

I have no particular opinion on changing the underline color though. Both seem fine to me.

@ciampo

ciampo commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

I'll drop the underline thickness change. One final idea that I'll mention as a possible hover visual change (especially if #82294 doesn't land) is to hide the underline on hover. But we don't have to discuss it now.

Let's make a choice of the underline color: same as text (proposed change), or weaker (as currently on trunk)?

@jameskoster

Copy link
Copy Markdown
Contributor

No strong opinion on underline color.

Removing the underline on hover could be worth trying, but kind of goes against the idea of the hover treatment reinforcing the interaction.

ciampo and others added 2 commits December 3, 2026 17:00
…tion-colors-82294

# Conflicts:
#	packages/components/CHANGELOG.md
Drop the thicker underline on hover and press from Link and ExternalLink, following review feedback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ciampo ciampo changed the title Components: Emphasize Link and ExternalLink interaction states Link: Draw the neutral underline in the text color Dec 3, 2026
@github-actions github-actions Bot removed the [Package] Components /packages/components label Dec 3, 2026
@ciampo

ciampo commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

The PR now only applies the underline color change. No thickness changes, no hover/focus changes.

IMO it's a subtle improvements, especially if/when the link text color change on hover/focus will be slightly more noticeable (see #82294). I suggest we merge this, and come back to it if it doesn't work out.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] UI /packages/ui [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants