What we want to change:
Whenever a custom property references another unknown (or guaranteed-invalid) custom property, that custom property becomes invalid at computed-value time (IACVT).
<style>
#outer { --x: foo; }
#inner { --x: var(--unknown); } /* --x becomes IACVT */
</style>
<div id=outer>
<div id=inner></div>
<div>
So what is the computed value of '--x' on #inner in this case? This is what we want to change.
The current behavior is that IACVT causes --x to behave as 'unset', and since custom properties inherit by default, the computed value becomes ' foo'.
The desired behavior is that IACVT causes --x to become the guaranteed-invalid value, hence it does not inherit from #outer, and gets no computed value at all.
Why:
1. There are certain "nested component patterns" that are more ergonomic if the guaranteed-invalid value is allowed to persist through the custom property reference chain. This is because the guaranteed-invalid value can trigger fallbacks, and having the guaranteed-invalid value persist means the author has greater control over when fallbacks happen, without "interference" from inheritance which might make some intermediate custom property suddenly not guaranteed-invalid anymore.
Here is an example provided by an author (source).
(The innermost "smaller input" is not smaller, because of inheritance "interfering" with the fallback mechanism).
This issue can be worked around by wrapping the component in an element as a "reset layer", but this is not always desirable.
2. A model in which the guranteed-invalid value is recognized as part of the value space of custom properties is more consistent and useful for our future plans for invalid-value handling of registered custom properties. (E.g. you can't currently register a property as a <color>, and also utilize the fallback functionality, but we want to allow that in the future). Tab explains about this in this comment.
I've added a use-counter for this which currently shows that ~0.02% of page loads may be affected by this. This is an upper-bound, and it does not automatically mean that 0.02% of page loads are broken, but that up to 0.02% can be affected. (Crafting a perfect use-counter is hard ...)
Bye,
Rego
--Bye,
Rego
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAKFBnUo7FkaqH%3D4ecBr8u9BsR%3Dpisg7BmRMW5QOY5nMWy1zoxw%40mail.gmail.com.
For the record, since some of the custom property names sound like they are theme-related, I also tested using --force-dark-mode, but it had no effect on the results. (None of the sites responded to the dark mode).Offending declaration: --primary-dark: var(--footer-color)Picked up by the use-counter because of --footer-color not existing. The custom property --primary-dark will now become invalid instead of the inherited value of rgb(131,35,128), but it doesn't seem to matter, since --primary-dark doesn't seem to be referenced by anything. When toggling the declaration of/off in devtools, nothing happens.Couldn't find the offending declaration. Nothing obviously broken.This is Pressbooks-based, so it's exactly the same as (1).Couldn't find the offending declaration. Nothing obviously broken.Pressbooks-based, same as (1).Offending declaration: --footer-payment-icon: var(--footer-payment-icon-inverted)Doesn't seem like --footer-payment-icon is referenced by anything. Nothing changes when the declaration is toggled.Pressbooks-based, same as (1).Pressbooks-based, same as (1).Pressbooks-based, same as (1).Offending declaration: --light-primary-color: var(--paper-indygo-100)Yet another case where the affected custom property isn't used. Nothing changes when the declaration is toggled.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAKFBnUq4Dv_E%3D_aEAcUH8OnQeT1gu-vv1JHfJ2SHndShUjaLvA%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/57f42dad-6ff6-45d8-41b0-e7ca8a9c4849%40igalia.com.