{{ message }}
[link] Revert to color-mix when underline color is not accepted - #49077
Open
silviuaavram wants to merge 1 commit into
Open
[link] Revert to color-mix when underline color is not accepted#49077silviuaavram wants to merge 1 commit into
silviuaavram wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates @mui/material/Link so the underline color is derived from the computed text color (currentColor) using CSS color-mix(), eliminating runtime color parsing that could throw for valid (but non-parsable) CSS colors like named keywords (e.g. white).
Changes:
- Switch
underline="always"to usetextDecorationColor: color-mix(..., currentColor 40%, transparent)and restore opaque underline (currentColor) on hover. - Remove palette-specific underline color logic and the
getTextDecorationhelper (and its unit tests). - Add coverage in
Link.test.jsto ensure named CSS colors don’t crash and (in non-JSDOM runs) validate underline color derives from computed text color.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
silviuaavram
force-pushed
the
feat/use-current-color-for-underline
branch
from
September 1, 2026 13:02
c24491f to
08a606d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #49052.
Closes #49054.
LinkusesgetTextDecorationto apply 40% opacity to its underline color. For color formats supported by MUI's JavaScript color parser, this continues to usealpha()as before.Valid CSS colors that the parser cannot decompose, such as named colors, previously caused
alpha()to throw during render. This change catches that failure and falls back to CSScolor-mix():This prevents the render failure while preserving the existing styling behavior:
colorprop, even whenstyleOverridesorsxchanges the rendered text color.Tests cover:
Linkwith a named CSS color without throwing.colorprop as the source of the underline color.