Skip to content

[css-ui] Computed value of currentColor #741

Closed
@frivoal

Description

@frivoal

css-ui-3 defines the computed value of caret-color this way:

The computed value for auto is auto. For values, the computed value is as defined for the [CSS3COLOR] color property.

The intent was (among other things) to have currentColor compute to currentColor as a keyword, but it is not clear if this wording is good to unambiguously define it that way.

In css-color-3, we're told that:

The used value of the ‘currentColor’ keyword is the computed value of the ‘color’ property. If the ‘currentColor’ keyword is set on the ‘color’ property itself, it is treated as ‘color: inherit’.

The first sentence says that currentColor is resolved at used value time, which implies that it stays as a keyword at computed value time. “treated as” in the second sentence implies that at computed value time on the color property, currentColor has been replaced with the computed value of the color property on the parent element.

Despite the fact that CSS-UI invokes the computed value logic of the color property, it wouldn't make much sense for currentColor on caret-color to “be treated as inherit”, but it would be possible to read it as currentColor being replaced by an actual color value at computed value time. Given that caret-color is an inherited property, this would lead to a different (undesirable) behavior than preserving it as a keyword at computed value time.

css-color-4 also agrees. It says the following about currentColor:

if the value is inherited, it’s inherited as currentcolor, not as the value of the color property, so descendants will use their own color property to resolve it.

Since the intended meaning in css-ui-3 and the meaning inferred by color-4 agree: currentColor should computed to currentColor as a keyword. I suggest making this unambiguous in css-ui-3 by changing the Computed Value entry in the propdef table to:

The computed value for auto is auto, and for currentColor is currentColor. For other values, the computed value is as defined for the color property.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions