-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Popup] New IDL for Pop-Up content attributes, which allow Element references #382
Comments
There hasn't been any discussion on this issue for a while, so we're marking it as stale. If you choose to kick off the discussion again, we'll remove the 'stale' label. |
Thanks for opening this issue and enumerating the various possible courses of action. Sorry there's been such a delay. But I'm in the process of implementing a prototype of the new Popup API and I got to the part where I might implement this bit. Of your two approaches, it sounds like you think #1 is the most developer-friendly. If so, I agree. I'm in favor of just allowing the The open issues that I can see are:
<button>Click me</button>
<div popup=popup>I'm a popup without an id</div>
<script>
const button = document.querySelector('button');
button.triggerPopup = document.querySelector('[popup]');
const attr = button.getAttribute('togglepopup'); // What does this return?
</script> |
Heya no worries on the timing, just happy to hear this is getting some love!
|
This moves the focus management stuff out of HTMLPopupElement and into Element, to work with both <popup> and <div popup>. With this CL, all of the WPTs now pass, with the exception of the one for the anchor IDL property, which is an open issue [1]. [1] openui/open-ui#382 Bug: 1307772 Change-Id: I0f475b52b1a14a910d267c7b681327f2e08976ac
This moves the focus management stuff out of HTMLPopupElement and into Element, to work with both <popup> and <div popup>. With this CL, all of the WPTs now pass, with the exception of the one for the anchor IDL property, which is an open issue [1]. [1] openui/open-ui#382 Bug: 1307772 Change-Id: I0f475b52b1a14a910d267c7b681327f2e08976ac
This moves the focus management stuff out of HTMLPopupElement and into Element, to work with both <popup> and <div popup>. With this CL, all of the WPTs now pass, with the exception of the one for the anchor IDL property, which is an open issue [1]. [1] openui/open-ui#382 Bug: 1307772 Change-Id: I0f475b52b1a14a910d267c7b681327f2e08976ac Cq-Do-Not-Cancel-Tryjobs: true
This moves the focus management stuff out of HTMLPopupElement and into Element, to work with both <popup> and <div popup>. With this CL, all of the WPTs now pass, with the exception of the one for the anchor IDL property, which is an open issue [1]. [1] openui/open-ui#382 Bug: 1307772 Change-Id: I0f475b52b1a14a910d267c7b681327f2e08976ac Cq-Do-Not-Cancel-Tryjobs: true
This moves the focus management stuff out of HTMLPopupElement and into Element, to work with both <popup> and <div popup>. With this CL, all of the WPTs now pass, with the exception of the one for the anchor IDL property, which is an open issue [1]. [1] openui/open-ui#382 Bug: 1307772 Change-Id: I0f475b52b1a14a910d267c7b681327f2e08976ac Cq-Do-Not-Cancel-Tryjobs: true
This moves the focus management stuff out of HTMLPopupElement and into Element, to work with both <popup> and <div popup>. With this CL, all of the WPTs now pass, with the exception of the one for the anchor IDL property, which is an open issue [1]. [1] openui/open-ui#382 Bug: 1307772 Change-Id: I0f475b52b1a14a910d267c7b681327f2e08976ac Cq-Do-Not-Cancel-Tryjobs: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3561291 Reviewed-by: David Baron <dbaron@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Commit-Queue: David Baron <dbaron@chromium.org> Cr-Commit-Position: refs/heads/main@{#988069}
This moves the focus management stuff out of HTMLPopupElement and into Element, to work with both <popup> and <div popup>. With this CL, all of the WPTs now pass, with the exception of the one for the anchor IDL property, which is an open issue [1]. [1] openui/open-ui#382 Bug: 1307772 Change-Id: I0f475b52b1a14a910d267c7b681327f2e08976ac Cq-Do-Not-Cancel-Tryjobs: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3561291 Reviewed-by: David Baron <dbaron@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Commit-Queue: David Baron <dbaron@chromium.org> Cr-Commit-Position: refs/heads/main@{#988069}
This moves the focus management stuff out of HTMLPopupElement and into Element, to work with both <popup> and <div popup>. With this CL, all of the WPTs now pass, with the exception of the one for the anchor IDL property, which is an open issue [1]. [1] openui/open-ui#382 Bug: 1307772 Change-Id: I0f475b52b1a14a910d267c7b681327f2e08976ac Cq-Do-Not-Cancel-Tryjobs: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3561291 Reviewed-by: David Baron <dbaron@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Commit-Queue: David Baron <dbaron@chromium.org> Cr-Commit-Position: refs/heads/main@{#988069}
…> to Element [popup 7/7], a=testonly Automatic update from web-platform-tests Migrate focus handling logic from <popup> to Element [popup 7/7] This moves the focus management stuff out of HTMLPopupElement and into Element, to work with both <popup> and <div popup>. With this CL, all of the WPTs now pass, with the exception of the one for the anchor IDL property, which is an open issue [1]. [1] openui/open-ui#382 Bug: 1307772 Change-Id: I0f475b52b1a14a910d267c7b681327f2e08976ac Cq-Do-Not-Cancel-Tryjobs: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3561291 Reviewed-by: David Baron <dbaron@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Commit-Queue: David Baron <dbaron@chromium.org> Cr-Commit-Position: refs/heads/main@{#988069} -- wpt-commits: 7e58a49e306020dbc50c235ad093356152b1d72b wpt-pr: 33437
anchor
and togglepopup
attributes
…> to Element [popup 7/7], a=testonly Automatic update from web-platform-tests Migrate focus handling logic from <popup> to Element [popup 7/7] This moves the focus management stuff out of HTMLPopupElement and into Element, to work with both <popup> and <div popup>. With this CL, all of the WPTs now pass, with the exception of the one for the anchor IDL property, which is an open issue [1]. [1] openui/open-ui#382 Bug: 1307772 Change-Id: I0f475b52b1a14a910d267c7b681327f2e08976ac Cq-Do-Not-Cancel-Tryjobs: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3561291 Reviewed-by: David Baron <dbaron@chromium.org> Auto-Submit: Mason Freed <masonf@chromium.org> Commit-Queue: David Baron <dbaron@chromium.org> Cr-Commit-Position: refs/heads/main@{#988069} -- wpt-commits: 7e58a49e306020dbc50c235ad093356152b1d72b wpt-pr: 33437
The Open UI Community Group just discussed The full IRC log of that discussion<dbaron> Topic: Explainer is missing imperative API for anchor and popup attributes<dbaron> github: https://github.com//issues/382 <emilio> q+ <JonathanNeal> q? <josephrexme> masonf: To set the state for #382, we have 2 attributes - anchor and togglepopup. Should there be a corresponding attribute you can use in JavaScript. Should you be able to pass in elements to the JavaScript API? <josephrexme> masonf: I'm curious if we should be doing this yet? I am interested in everyone's thoughts <josephrexme> bkardell_: I think any controversy that remains on those has nothing to do should not prevent you from proposing something <josephrexme> emilio: I agree that if we should we should have elements, it should be separate from the attribute name. showpopups do get an element as you open them but you cannot change it dynamically <josephrexme> emilio:I don't think there's a use case for switching anchors dynamically <josephrexme> masonf: showPopups only lets you change the anchor when you open them? <JonathanNeal> q? <josephrexme> emilio: right <emilio> ack emilio |
For reference, as a point of prior art, the anchor in XUL popups is specified only on open, as an element reference: The element has a readonly getter for that (that returns non-null while open): Reading the original test-case in #382 (comment), I'd also note that it is probably reasonable to let popups look up the containing DOM tree. The problematic case is digging into shadow trees for IDrefs (which is a no-go). Things like nested |
Thanks for this comment (and the discussion just now). A few comments/counterpoints:
|
For looking up the tree for idrefs, I think the most-reasonable behavior is perhaps like you said not to go digging in shadow roots, but it sounds vaguely similar to But limiting anchor / idref lookup only to the parent tree (please lmk if I'm misunderstanding your suggestion) might run into issues such as the use case of using a singleton popup element, which is what we ended up doing at YouTube, since the number of inert / unused popup tooltips on a site that large was starting to cause performance problems. Though, if this proposal fixes the stacking context problem that required popups to be hoisted to the end of |
I'm curious about whether there's a use case for changing the target anchor while the popup is already open (and whether hiding and reopening the popup is not an option / acceptable workaround, assuming that's an edge case). Reason for that question is that it can change the different trade-offs significantly. For example, looking up idrefs in arbitrary trees "up" is trivial with such a model (you just go up calling |
one use case is the reuse of a common component (popup) that can be invoked by different triggers. for instance, i see this a lot with react applications where there is a single popup that is reused across multiple instances and the contents of the popup, even if they don't necessarily change - e.g., menu items - are associated with a different invoking element and it's parent context. For instance, a table/grid that contains rows of data where there is a menu button that invokes a menu popup that allows a user to do various actions. A single popup component can be reused for each of these invoking buttons. Additionally, a common use case here is for these menu popups to contain a delete menu item. In these cases an alternate "anchor" element needs to be specified to ensure that focus does not return to the body - which commonly results in screen reader users being sent back to the top of the document and needing to re-navigate the page to return to where they last left off. Whether or not both of these situations is exactly the intent of the anchoring mechanism, it is at least related to what authors need to do now, and have expressed frustration over, not to mention the fact that users who need this mechanism in place are left to wait for custom implementations. |
@scottaohara sure, but I don't see how that would change the anchor while the popup is open, right? What am I missing? |
@hidde Agreed |
The Open UI Community Group just discussed
The full IRC log of that discussion<gregwhitworth> Topic: [Popup] Imperative API for anchor and togglepopup attributes<gregwhitworth> github: https://github.com//issues/382 <gregwhitworth> q? <hdv> masonf: ok, 382 is a big issue by the number of things, but one is the most important now: the conversation for today would be about renaming <hdv> masonf: there are three invoking attributes now, they need to be reflected in IDL, but the problem is that conflicts because there are also JS methods with the same name <Travis> [please]showPopup() <Travis> +1 <hdv> masonf: there are some suggestions, the one I liked most was to rename to popuptarget, popupshowtarget, popuphidetarget, a little more descriptive and doesn't conflict <hdv> gregwhitworth: what were they prior? <hdv> masonf: showpopup, hidepopup, togglepopup <hdv> gregwhitworth: I like the dbaron's suggestions way better, +100 from me <bkardell_> Travis: only if this fires a [youareWelcome]popup event <hdv> +1 <masonf> Proposed resolution: rename togglepopup to popuptarget, showpopup to popupshowtarget, and hidepopup to popuphidetarget. Reflect the string value of these three content attributes in IDL as .popUpTarget, .popUpShowTarget, and .popUpHideTarget. <hdv> Travis: are you suggesting both updating IDL names and content attribute names? <scotto_> q+ <hdv> masonf: yes technically we don't have IDL reflections just yet <gregwhitworth> ack scotto_ <masonf> popuptoggletarget <masonf> ? <hdv> scotto_: to be honest, I don't really care, but… popuptarget doesn't say toggle to me <hdv> masonf: we could do popuptoggletarget? <hdv> +1 to scott's idea actually, it is German Naming Convention ish <Travis> I don't know, minified code can be pretty small... <masonf> Proposed resolution: rename togglepopup to popuptoggletarget, showpopup to popupshowtarget, and hidepopup to popuphidetarget. Reflect the string value of these three content attributes in IDL as .popUpToggleTarget, .popUpShowTarget, and .popUpHideTarget. <scotto_> +1 <hdv> +1 <dandclark> +1 <AlexanderFutekov> +1 <Travis> I like that the names group the attribute together by 'popup'. <masonf> RESOLVED: rename togglepopup to popuptoggletarget, showpopup to popupshowtarget, and hidepopup to popuphidetarget. Reflect the string value of these three content attributes in IDL as .popUpToggleTarget, .popUpShowTarget, and .popUpHideTarget. |
Per the resolution, we've solved the issue of attribute reflections (of the string values) for the three triggering attributes. I'll leave this issue open for the (longer term) discussion about non-string-valued IDL reflections, which allow element references to be directly set. |
Per the resolution [1], we are renaming: - togglepopup -> popuptoggletarget - showpopup -> popupshowtarget - hidepopup -> popuphidetarget A subsequent CL will add IDL reflections of these attributes. [1] openui/open-ui#382 (comment) Bug: 1307772 Change-Id: I3cf663b50b0b0f10cbc39d723608b1dcd28662e0 Cq-Do-Not-Cancel-Tryjobs: true
Per the resolution [1], we are renaming: - togglepopup -> popuptoggletarget - showpopup -> popupshowtarget - hidepopup -> popuphidetarget A subsequent CL will add IDL reflections of these attributes. [1] openui/open-ui#382 (comment) Bug: 1307772 Change-Id: I3cf663b50b0b0f10cbc39d723608b1dcd28662e0 Cq-Do-Not-Cancel-Tryjobs: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3764624 Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Reviewed-by: Nektarios Paisios <nektar@chromium.org> Commit-Queue: Nektarios Paisios <nektar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1025053}
Per the resolution [1], we are renaming: - togglepopup -> popuptoggletarget - showpopup -> popupshowtarget - hidepopup -> popuphidetarget A subsequent CL will add IDL reflections of these attributes. [1] openui/open-ui#382 (comment) Bug: 1307772 Change-Id: I3cf663b50b0b0f10cbc39d723608b1dcd28662e0 Cq-Do-Not-Cancel-Tryjobs: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3764624 Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Reviewed-by: Nektarios Paisios <nektar@chromium.org> Commit-Queue: Nektarios Paisios <nektar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1025053}
Per the resolution [1], we are renaming: - togglepopup -> popuptoggletarget - showpopup -> popupshowtarget - hidepopup -> popuphidetarget A subsequent CL will add IDL reflections of these attributes. [1] openui/open-ui#382 (comment) Bug: 1307772 Change-Id: I3cf663b50b0b0f10cbc39d723608b1dcd28662e0 Cq-Do-Not-Cancel-Tryjobs: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3764624 Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Reviewed-by: Nektarios Paisios <nektar@chromium.org> Commit-Queue: Nektarios Paisios <nektar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1025053}
Per the (new) resolution [1], this CL adds IDL reflections of the new triggering content attributes: popuptoggletarget, popupshowtarget, and popuphidetarget. These IDL attributes set/return just the text content of the content attribute, and cannot set elements directly, per the [2] resolution. [1] openui/open-ui#382 (comment) [2] openui/open-ui#382 (comment) Bug: 1307772 Change-Id: Iefe60ea7b86b606b0b3b8447fcebdcf576ac1771
Per the (new) resolution [1], this CL adds IDL reflections of the new triggering content attributes: popuptoggletarget, popupshowtarget, and popuphidetarget. These IDL attributes set/return just the text content of the content attribute, and cannot set elements directly, per the [2] resolution. [1] openui/open-ui#382 (comment) [2] openui/open-ui#382 (comment) Bug: 1307772 Change-Id: Iefe60ea7b86b606b0b3b8447fcebdcf576ac1771
Per the (new) resolution [1], this CL adds IDL reflections of the new triggering content attributes: popuptoggletarget, popupshowtarget, and popuphidetarget. These IDL attributes set/return just the text content of the content attribute, and cannot set elements directly, per the [2] resolution. [1] openui/open-ui#382 (comment) [2] openui/open-ui#382 (comment) Bug: 1307772 Change-Id: Iefe60ea7b86b606b0b3b8447fcebdcf576ac1771 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3764319 Auto-Submit: Mason Freed <masonf@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1026302}
Per the (new) resolution [1], this CL adds IDL reflections of the new triggering content attributes: popuptoggletarget, popupshowtarget, and popuphidetarget. These IDL attributes set/return just the text content of the content attribute, and cannot set elements directly, per the [2] resolution. [1] openui/open-ui#382 (comment) [2] openui/open-ui#382 (comment) Bug: 1307772 Change-Id: Iefe60ea7b86b606b0b3b8447fcebdcf576ac1771 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3764319 Auto-Submit: Mason Freed <masonf@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1026302}
Per the (new) resolution [1], this CL adds IDL reflections of the new triggering content attributes: popuptoggletarget, popupshowtarget, and popuphidetarget. These IDL attributes set/return just the text content of the content attribute, and cannot set elements directly, per the [2] resolution. [1] openui/open-ui#382 (comment) [2] openui/open-ui#382 (comment) Bug: 1307772 Change-Id: Iefe60ea7b86b606b0b3b8447fcebdcf576ac1771 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3764319 Auto-Submit: Mason Freed <masonf@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1026302}
…tc., a=testonly Automatic update from web-platform-tests Rename togglepopup->popuptoggletarget, etc. Per the resolution [1], we are renaming: - togglepopup -> popuptoggletarget - showpopup -> popupshowtarget - hidepopup -> popuphidetarget A subsequent CL will add IDL reflections of these attributes. [1] openui/open-ui#382 (comment) Bug: 1307772 Change-Id: I3cf663b50b0b0f10cbc39d723608b1dcd28662e0 Cq-Do-Not-Cancel-Tryjobs: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3764624 Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Reviewed-by: Nektarios Paisios <nektar@chromium.org> Commit-Queue: Nektarios Paisios <nektar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1025053} -- wpt-commits: c1a12d754ff80d115d6fea2fb95b5c8d1b99fe12 wpt-pr: 34854
… attributes, a=testonly Automatic update from web-platform-tests Add IDL reflections of pop-up triggering attributes Per the (new) resolution [1], this CL adds IDL reflections of the new triggering content attributes: popuptoggletarget, popupshowtarget, and popuphidetarget. These IDL attributes set/return just the text content of the content attribute, and cannot set elements directly, per the [2] resolution. [1] openui/open-ui#382 (comment) [2] openui/open-ui#382 (comment) Bug: 1307772 Change-Id: Iefe60ea7b86b606b0b3b8447fcebdcf576ac1771 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3764319 Auto-Submit: Mason Freed <masonf@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1026302} -- wpt-commits: a4e9e57e74d671be0525568fbc7dec17b7ab4149 wpt-pr: 34864
anchor
and togglepopup
attributes…tc., a=testonly Automatic update from web-platform-tests Rename togglepopup->popuptoggletarget, etc. Per the resolution [1], we are renaming: - togglepopup -> popuptoggletarget - showpopup -> popupshowtarget - hidepopup -> popuphidetarget A subsequent CL will add IDL reflections of these attributes. [1] openui/open-ui#382 (comment) Bug: 1307772 Change-Id: I3cf663b50b0b0f10cbc39d723608b1dcd28662e0 Cq-Do-Not-Cancel-Tryjobs: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3764624 Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Reviewed-by: Nektarios Paisios <nektar@chromium.org> Commit-Queue: Nektarios Paisios <nektar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1025053} -- wpt-commits: c1a12d754ff80d115d6fea2fb95b5c8d1b99fe12 wpt-pr: 34854
… attributes, a=testonly Automatic update from web-platform-tests Add IDL reflections of pop-up triggering attributes Per the (new) resolution [1], this CL adds IDL reflections of the new triggering content attributes: popuptoggletarget, popupshowtarget, and popuphidetarget. These IDL attributes set/return just the text content of the content attribute, and cannot set elements directly, per the [2] resolution. [1] openui/open-ui#382 (comment) [2] openui/open-ui#382 (comment) Bug: 1307772 Change-Id: Iefe60ea7b86b606b0b3b8447fcebdcf576ac1771 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3764319 Auto-Submit: Mason Freed <masonf@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1026302} -- wpt-commits: a4e9e57e74d671be0525568fbc7dec17b7ab4149 wpt-pr: 34864
@mfreed7 apologies if this is on a slight tangent to the original topic. Back in April you mentioned above:
Are you suggesting that depending on the outcome of the anchored positioning proposal, that the popup attribute may not require positioning on the top-layer? It sounds like even with anchor positioning as outlined in the proposal, the popup would still be constrained to the bounding container having overfow |
No, sorry, I meant that the anchor positioning API will allow not just pop-ups to be anchor positioned, but also ordinary elements that are fixed/absolute positioned. The pop-up API definitely still puts elements into the top layer, which escapes overflow containers, transforms, etc. |
Based on the HTML spec PR review, the IDL reflections for these three attributes has been changed to be element references, and renamed accordingly: I'm going to close this issue. |
NOTE: this issue was originally written when the popup proposal still included a
<popup>
element. It has since been edited, but there may be some inconsistenciesThe problem
The current Popup explainer seems to be missing some imperative API docs for certain features such as the
anchor
andtogglepopup
attributes.The background
The reason why an imperative API would help is that ID's for associating elements leads into multiple problems:
For example, shadow roots:
The above example has an anchor with id
my-anchor
and a popup inside of a shadow root (using the declarative shadow dom api). Adding[anchor=my-anchor]
todiv[popup]
will not work as ID's cannot penetrate shadow roots, andbutton[togglepopup=my-popup]
will also not work because it won't be able to penetrate the shadow root to find the popup.Example ID generation:
The above example in react would require generating an ID to link a popup button with a popup (same situation would exist with anchor) when an imperative solution (like a ref or a function callback) would suffice.
Proposed solution
Defining an imperative way to associate element's popup or anchor.
I see two options here:
anchor
andtogglepopup
properties onHTMLElement
to support element references as well as stringsetAnchor(el: HTMLElement)
andtogglePopUp(el: HTMLPopupElement)
Both of these options solve the problems above, but have different tradeoffs.
Allowing property to support Element references
The positives about this approach is that it will allow for better declarative programming on modern templating frameworks such as React and lit-html. For example:
React:
Lit:
note: the
.propName=${val}
syntax denotes a property binding not an attribute binding e.g.el.propName = val
rather thanel.setAttribute('propName', val)
The negatives are that there is current no precedent that I know of for an element property accepting both a string, or an element reference.
Function setters
The Positives about this approach are that it will enable all these use cases and it fits with precedent (not having a single property accept HTMLElement or string)
The Negatives requires component authors to wire things up a bit more. e.g.
React:
Lit:
Acceptance criteria
Some sort of element-reference imperative API for
anchor
is defined, or something that makes it easy to componentize HTMLElement[popup], especially in Shadow DOMThe text was updated successfully, but these errors were encountered: