Skip to content

Reference Target "phase 2": seeking feedback and use cases #1111

@alice

Description

@alice

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 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, which encloses an <input type=checkbox> in order to enhance its appearance and behaviour, and the second is md-dialog, which encloses a <dialog>.

"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:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions