[WICG/webcomponents] Reference Target "phase 2": seeking feedback and use cases (Issue #1111)

alice created an issue (WICG/webcomponents#1111)

Summary: What use cases have you encountered for needing to refer to *specific elements* within shadow DOM, as opposed to having references to the host forwarded to a "catch-all" delegate?

---

Longer version:

I recently made some edits to the [Reference Target explainer](https://github.com/WICG/webcomponents/blob/gh-pages/proposals/reference-target-explainer.md) to more clearly lay out the specific use cases which are being addressed, and to reframe "Phase 2" in terms of the distinct problems not solved by the single `referenceTarget` attribute.

As I understand it, **"Phase 1"**, i.e. `referenceTarget`, regards the specific problem of reusing built-in elements within the shadow DOM of a component intended fulfil an analogous role in the page. That is, authors using the component need have no knowledge that the element they "intend" to refer to is actually the element in shadow DOM: their intent is to refer to the host, and, as an implementation detail, the host forwards that reference to the enclosed element. There are two examples in the explainer of shipping web components which do this; the first is [`sp-checkbox`](https://opensource.adobe.com/spectrum-web-components/components/checkbox/), which encloses an `<input type=checkbox>` in order to enhance its appearance and behaviour:

```html
<sp-checkbox indeterminate>
  #shadow-root
  | <input id="input" type="checkbox"> <!-- has .indeterminate IDL attribute set -->
  | <span id="box"><!-- partial checkmark rendering --></span>
  | <label id="label" for="input">
  |   <slot></slot>
  | </label>
Indeterminate
</sp-checkbox>
```

**"Phase 2"** I understand to be concerned with the problem of finer-grained references into shadow DOM, where authors actually do intend to refer to individual elements within a component's shadow DOM. 

The explainer contains the two use cases I'm aware of: [using `aria-activedescendant` to refer to an autocomplete option](https://github.com/WICG/webcomponents/blob/gh-pages/proposals/reference-target-explainer.md#aria-activedescendant-and-comboboxes), and [using `aria-labelledby` and `aria-describedby` to fine-tune a component's text alternative](https://github.com/WICG/webcomponents/blob/gh-pages/proposals/reference-target-explainer.md#fine-grained-aria-labelledby-and-aria-describedby).

Are there any other circumstances under which you've needed to refer to specific, individual elements in shadow DOM?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/1111
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/1111@github.com>

Received on Friday, 22 August 2025 16:08:24 UTC