Skip to content

[css-pseudo] highlights and color:currentColor #6818

Closed

Description

Image for: Description

https://drafts.csswg.org/css-pseudo-4/#highlight-text

For this purpose, ‘currentColor’ on a highlight pseudo-element’s ‘color’ property represents the ‘color’ of the next highlight pseudo-element layer below, falling back finally to the colors that would otherwise have been used (those applied by the originating element or an intervening pseudo-element such as ‘::first-line’ or ‘::first-letter’).

  1. When we choose the “next highlight pseudo-element layer below”, do we consider only the layers that are actively highlighting the content in question? I think it makes sense to do so, in order for color:currentColor to effectively mean “highlighting with this pseudo doesn’t change the foreground color”. Otherwise, color:currentColor on ::selection always yields ::target-text’s default foreground color, even when that’s irrelevant to the content.

  2. If so, what is the result of getComputedStyle(..., "::selection").color? The problem is that we need the resolved value, which would be indeterminate for a highlight with color:currentColor. Even if the active highlights were the same throughout the whole originating element, giving us a single unambiguous answer, we can only expose that answer if it didn’t come from ::spelling-error or ::grammar-error (#highlight-security).

(cc @mrego, @frivoal)

Metadata

Image for: Metadata

Metadata

Image for: Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Image for: Issue actions