Talking to @emilio about this topic, he suggested that this is quite similar to what Shadow parts do: https://w3c.github.io/csswg-drafts/css-shadow-parts-1/
With shadow parts you mark with part attribute and element you want to style from the outside. Like
<x-label id="customlabel">
#shadow-root
<label part="aria-labelledby">My custom label</label>
</x-label>
Then you can style that with ::part(aria-labelledby).
There are no JS API right now, but if you could do something like customlabel.part("aria-labelledby") that would expose that element and allow referencing it from the outside, maybe that could be a solution we can re-use for this problem.
Talking to @emilio about this topic, he suggested that this is quite similar to what Shadow parts do: https://w3c.github.io/csswg-drafts/css-shadow-parts-1/
With shadow parts you mark with
partattribute and element you want to style from the outside. LikeThen you can style that with
::part(aria-labelledby).There are no JS API right now, but if you could do something like
customlabel.part("aria-labelledby")that would expose that element and allow referencing it from the outside, maybe that could be a solution we can re-use for this problem.