Reference Target #10707
Labels
addition/proposal
New features or enhancements
needs implementer interest
Moving the issue forward requires implementers to express interest
stage: 1
Incubation
What problem are you trying to solve?
Element-to-element relationships that are specified based on element IDs, like many of the
aria-
attributes, run into problems when they need to be created between elements on the opposite sides of a shadow DOM boundary.The ARIAMixin IDL attributes (such as ariaLabelledbyElements and ariaActiveDescendantElement) solve this problem in one direction, allowing references to be created from inside a shadow DOM to an element outside the shadow DOM (unless the target element is in another shadow DOM).
But no solution exists for creating a reference from outside a shadow targeting an element inside a shadow. RererenceTarget allows this kind of relationship to be established. When combined with the AriaMixin attributes it can be used to create references from inside one shadow to inside another.
What solutions exist today?
The ARIAMixin IDL attributes (such as ariaLabelledbyElements and ariaActiveDescendantElement) allow references to be created from inside a shadow DOM to an element outside the shadow DOM, but not in the other direction. Nothing exists today for creating references from outside a shadow to inside a shadow.
How would you solve it?
The proposed
referenceTarget
property onShadowRoot
that causes all ID references pointing to the host to be forwarded to an element inside the shadow with the given ID.This can be done imperatively:
Or declaratively:
This would work with any attribute that works with ID; for the full list see here.
A Phase 2 of this proposal would extend the idea with
referenceTargetMap
, which allows individual attributes to be redirected to separate elements in the shadow DOM.Anything else?
For more info and alternatives considered, see the explainer: https://github.com/WICG/webcomponents/blob/gh-pages/proposals/reference-target-explainer.md
This was discussed in a TPAC breakout session. See notes and slides.
Phase 1 is prototyped in Chromium behind
--enable-experimental-web-platform-features
.The text was updated successfully, but these errors were encountered: