WICG / webcomponents

Web Components specifications
Other
4.39k stars 376 forks source link

Reference Target naming #1087

Open alice opened 1 hour ago

alice commented 1 hour ago

There has been a reasonable amount of feedback that the name referenceTarget is difficult to understand.

I think it's a reasonable name (ID references to the host should instead go to the designated target), but it might be good to see if we can come up with some alternatives.

One thing we should keep in mind is that if we choose to use separate attributes for each attribute for Phase 2, it would be nice to have a noun which can be used in combination with existing attributes (e.g. "shadowrootariaactivedescendanttarget").

alice commented 1 hour ago

One comparison that gets made a lot is between referenceTarget and delegatesFocus.

"Delegates" is a verb in delegatesFocus, and delegatesFocus is a boolean, so there's no close mapping possible, but we could potentially align with the related spec concept of of focus delegate with something like referenceDelegate.

In fact, that was the name originally proposed: https://github.com/WICG/webcomponents/blob/gh-pages/proposals/reference-target-explainer.md#alternative-names-for-the-feature-reference-target

rniwa commented 1 hour ago

hm... how about idForwarding or idTarget?

Westbrook commented 45 minutes ago

hm... how about idForwarding or idTarget?

Feels like anything specifically revolving around “id” flies in the face of W3C TAG wanting to find a path away from needing to rely on IDs to reference things across the DOM. 🤷🏼‍♂️

As a component author, I’ve no problems with referenceTarget, particularly in that I don’t need to read from it almost ever and expect to write to it only slightly more frequently. Naming only feels like it would be of issue here if (when?) the suggestion away from a micro DSL for maps in Level 2 is enforced.

Not to make a specific vote for it, but if a rename is required… in a world where commandFor is becoming a thing would expanding on “for” in some way be appropriate? e.g. delegatesFor or targetFor