- From: CSS Meeting Bot via GitHub <noreply@w3.org>
- Date: Wed, 01 Apr 2026 20:59:34 +0000
- To: public-css-archive@w3.org
The CSS Working Group just discussed `[css-mixins-1] Expose locals inside apply's contents block`, and agreed to the following:
* `RESOLVED: Contents blocks don't interact with the private variables of the mixin. Investigate allowing that in the next level.`
<details><summary>The full IRC log of that discussion</summary>
<fantasai> TabAtkins: We have a DIV setting custom properties on itself. It then calls a mixin, both passing one of those custom properties as a param<br>
<fantasai> ... and also passing an @contents block referencing that variable.<br>
<fantasai> TabAtkins: Is this var() in the contents block always resolving against the DIV's own --a, or--if the mixin defines its own --a--can the contents block reference that?<br>
<bkardell> gold<br>
<bkardell> ⭐<br>
<fantasai> div { --a: gold; @apply --bar(var(--a)) { --coor: var(--a); } ; }<br>
<fantasai> TabAtkins: The two var references are close to each other. Seems like they should resolve the same way.<br>
<fantasai> TabAtkins: On the other hand, there are use cases for being able to pass in a block that relies on variables that the mixin sets up for it.<br>
<fantasai> TabAtkins: 2 parts of my proposal<br>
<lea> q+<br>
<fantasai> TabAtkins: 1. By default, if you write this, that var() will never reference anything inside the mixin.<br>
<fantasai> TabAtkins: Nothing defined in the mixin will influence the contents of the contents block.<br>
<fantasai> TabAtkins: 2. If you do want to resolve against the mixin body, then add some new syntax ('using --a') to evaulate against the mixin body.<br>
<fantasai> TabAtkins: That would allow you to resolve against the injected context.<br>
<kizu> q+<br>
<astearns> ack lea<br>
<fantasai> lea: I'm finding it very hard to figure out what happens without seeing the mixin.<br>
<lea> scribe+<br>
<lea> lea: If we have a mixin that uses the `@contents` block inside a descendant that has a different `--a` value, which one would it get?<br>
<fantasai> TabAtkins: Is this the question? [screen] Contents block is styling your variable.<br>
<miriam> q+<br>
<fantasai> TabAtkins: In this case, the answer is, that --a would not be captured by the var(). It would resolve normally, so it would grab the tomato from the span.<br>
<fantasai> lea: Locals of mixin should be mixin implementation details. Feels weird for contents block to have access to it.<br>
<astearns> ack kizu<br>
<fantasai> TabAtkins: There are use cases for it, but I think I also prefer to defer that functionality to level 2 becuase it's complex<br>
<fantasai> kizu: OK to defer this to L2.<br>
<kbabbitt> +1 that mixin locals should be local to the mixin<br>
<fantasai> kizu: This is something that can be very useful.<br>
<fantasai> kizu: Mixin could expose a number of useful tools inside that you could use on your elements.<br>
<fantasai> kizu: but I agree that by default that authors wouldn't expect to access those<br>
<fantasai> kizu: Opting in would be better.<br>
<fantasai> kizu: I like 'using' syntax. Especially having 'all'.<br>
<astearns> ack miriam<br>
<fantasai> kizu: But agree with moving to L2 and do expected thing for authors now.<br>
<fantasai> miriam: Deferring is fine. Just to overcomplicate the example we have on the screen<br>
<fantasai> miriam: It's possible that we change the value of --a in the mixin, but not in the part of the mixin where the contents block is being used.<br>
<fantasai> miriam: we change it not as a local but as an output<br>
<fantasai> TabAtkins: Yes, that would be visible.<br>
<fantasai> miriam: So we're not saying that the contents of the mixin can't affect the var, only the *private* internals have no impact<br>
<fantasai> TabAtkins: right<br>
<fantasai> PROPOSED: Contents blocks don't interact with the private variables of the mixin. Investigate allowing that in the next leve.<br>
<fantasai> RESOLVED: Contents blocks don't interact with the private variables of the mixin. Investigate allowing that in the next level.<br>
</details>
--
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12631#issuecomment-4172934882 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 1 April 2026 20:59:35 UTC