Re: [csswg-drafts] [css-anchor-position-1] Allow anchor references to match names in outer tree scopes (#9408)

Minor correction: when `.anchored` is in a deep-nested tree scope, we can still style it with `::part`, but also need a long chain of [`[exportparts]`](https://drafts.csswg.org/css-shadow-parts/#exportparts-attr), which is still quite a burden to maintain.

Also, with the proposal, we can solve everything nicely without breaking encapsulation regardless of how deep the shadow tree nesting is, by passing the anchor name into the custom element via a custom property. For example:

```html
<custom-element style="--custom-element-anchor-name: --anchor-1">
  #shadow-root
    <div class="anchored"></div>
    <style>
      .anchored { inset-block-start: anchor(var(--custom-element-anchor-name) top); }
    </style>
</custom-element>
<script>
```

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


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

Received on Tuesday, 26 September 2023 00:57:59 UTC