w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.49k stars 660 forks source link

[css-conditional-5] Evaluate IACVT style queries to false #11143

Open andruud opened 2 hours ago

andruud commented 2 hours ago

The current spec can be interpreted to evaluate the following style query to true:

  @property --test {
    syntax: "a";
    initial-value: a;
    inherits: true;
  }
  @container style(--test: b) {
    body {
      background: lightgreen;
    }
  }

(Test case from @kizu.)

This is because the query value is described to go through the regular computed value process, and additionally non-cascade dependent keywords are allowed (that includes unset, which IACVT falls back to). This causes --test:b => IACVT => unset => a, which indeed is the computed value of --test on body.

I fairly certain that we want to evaluate any IACVT query to "false"? @mirisuzanne @lilles

lilles commented 2 hours ago

I fairly certain that we want to evaluate any IACVT query to "false"? @mirisuzanne @lilles

Yes, I think so.

It's probably useful to consider what will happen with IACVT if/when we start supporting standard properties.

For instance @container style(color: var(--my-length)) and --my-length: 2px. Making that unset and have it match depending on whether the style container has the same computed color as its parent or not sounds strange, yes.

I don't remember if there was a discussion around allowing unset and inherit, but initial definitely makes sense.

mirisuzanne commented 1 hour ago

I agree that IACVT should not evaluate true - but should it be false or unknown?