Repository navigation
fix(core): unresolved var() unsets the whole value and invalid color-mix() no longer renders white - #11593
Merged
Conversation
…mix() no longer renders white A var() referencing an undefined or empty custom property, with no fallback or with a fallback that also fails to resolve, now makes the whole declaration unset, as CSS specifies for values that are invalid at computed-value time. Before, `unset` was substituted inline, so values like `color-mix(in srgb, var(--missing) 35%, transparent)` turned into an unparseable color, and `calc(var(--missing) + 10)` evaluated to 10. A color-mix() that fails to parse now throws `Invalid color: <value>` like every other malformed color string, so the declaration is dropped. Before, the parser's -1 sentinel was stored as the color, which renders as white on Android and transparent blue on iOS.
|
View your CI Pipeline Execution ↗ for commit 7880788
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
commit: |
edusperoni
marked this pull request as ready for review
October 29, 2026 15:39
3 of 5 tasks
# Conflicts: # packages/core/ui/core/properties/css-variable-expression.spec.ts
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.
PR Checklist
What is the current behavior?
argbFromColorMix()returns-1when@csstools/css-color-parsercannot parse the value, andColorBasestores it as the color. That is opaque white on Android, and transparent blue (invisible) on iOS, which builds the color from the r/g/b/a getters._evaluateCssVariableExpressionsubstitutesunsetinline, socolor-mix(in srgb, var(--missing) 35%, transparent)becomescolor-mix(in srgb, unset 35%, transparent), which fails to parse.calc(var(--missing) + 10)evaluate to10.What is the new behavior?
This follows the CSS spec:
var(): avar()with no value (undefined, empty, orunset) and no fallback that resolves makes the whole declaration invalid at computed-value time, so the property isunset. This holds wherever thevar()is nested:color-mix(),calc(), shorthands, multi-value strings. An unresolvedvar()inside the fallback of avar()that did resolve is ignored, as in browsers:var(--defined, var(--missing))gives--defined.color-mix(): throwsInvalid color: <value>, like every other unparseable color string. The cascade already catches and traces that, so the declaration is dropped instead of painting white.Behavior changes:
calc(var(--missing) + 10)is nowunsetinstead of10.margin: var(--a) var(--missing)now unsets the whole shorthand instead of only the missing part.color-mix(in --swop5c, red, blue)spec used to assert the decoded-1sentinel. It is now a throw case: without a color profile the value cannot be parsed, and browsers drop it too.