Re: [whatwg/dom] Add reference target to shadow root (PR #1353)

@dandclark commented on this pull request.



> @@ -6057,6 +6058,7 @@ interface ShadowRoot : DocumentFragment {
   readonly attribute boolean clonable;
   readonly attribute boolean serializable;
   readonly attribute Element host;
+  attribute DOMString? referenceTarget;

Sorry for the slow follow up here -- v2 is sketched out at https://github.com/WICG/webcomponents/blob/gh-pages/proposals/reference-target-explainer.md#-phase-2-shadowroot-referencetargetmap-attribute.

That examples in that proposal imply an IDL like this:

```
interface ShadowRoot : DocumentFragment {
  // ...
  attribute DOMString? referenceTarget;
  attribute ReferenceTargetMap referenceTargetMap; // added in Phase 2.
}

// Added in Phase 2:
interface ReferenceTargetMap {
  DOMString? ariaControls;
  DOMString? ariaActiveDescendant;
  DOMString? htmlFor;
  // etc...
}
```

So the behavior would be that `shadowRoot.referenceTarget` is the default, and is overridden by any non-null values in the `ReferenceTargetMap`.

I can see an argument for grouping everything together into a single `ReferenceTarget` interface, but I do think it'd be nice to keep the simple case simple and allow a direct `shadowRoot.referenceTarget = "target"` rather than requiring the additional indirection `shadowRoot.referenceTarget.default = "target"`. Either design seems basically reasonable though.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/1353#discussion_r2076547720
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/pull/1353/review/2819988873@github.com>

Received on Tuesday, 6 May 2025 23:42:20 UTC