Re: [csswg-drafts] [css-mixins-1] A var()-based model for mixin parameters (#12927)

I like this overall solution for variables in mixins. I have some concerns about assuming mixins can only impact descendants - though it certainly does help sidestep the question of where variables resolve. I just expect patterns like [disclosure widgets](https://adrianroselli.com/2020/05/disclosure-widgets.html) might also be candidates for mixins:

```css
button[aria-expanded="false"] + div {
  display: none;
}
```

On the other hand, this could be written to apply on the div, and reference the button as context outside the scope:

```css
@mixin --disclose {
  button[aria-expanded="false"] + & {
    display: none;
  }
}

.show-hide { @apply --disclose; }
```

So maybe that works out ok. The concern would be if we need variables to resolve on one sibling and apply to the other.

If we do assume this, then `:scope` in a mixin refers to the applying element?

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


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

Received on Wednesday, 15 October 2025 19:19:45 UTC