Re: [csswg-drafts] [css-pseudo] Custom properties on :root (#6641)

Summary for the F2F discussion. The problem is how to evaluate custom property values in highlight pseudos, when the common web practice is to define custom properties on the root element. Options discussed in the past include adding new ways to define document-wide custom properties (@document), but proposals have narrowed to the following options.

* Inherit custom properties from the originating element — there is precedent for pulling property values from the originating element e.g. https://github.com/w3c/csswg-drafts/issues/7264  (implemented with some memory usage penalty iiuc) - but they are addressing "where do I get values I can't define on highlights at all" so there is no chance that such values would appear in the highlight inheritance chain. However, custom properties might be defined in the highlight chain, in which case we should use them, and only if not would they come from the originating element. This is challenging from an authoring and implementation perspective.
* Have the root highlights inherit all properties from :root. This is simple but significantly increases the chance of paired defaults getting out of sync when the author sets one color on the root while the other is inherited from the UA style sheet. i.e. selection color and background may cease to have enough contrast.
* root highlights inherit _custom_ properties from :root. The downside is that custom properties defined elsewhere in the tree will not influence highlights, but breakage here is hypothetical and, should authors desire it, the custom property may still be defined on the highlight pseudo inheritance chain.

Maybe in the future we could revisit @document etc. if it would solve multiple use cases.


-- 
GitHub Notification of comment by schenney-chromium
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6641#issuecomment-1641196754 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 19 July 2023 00:28:58 UTC