You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The "open" attribute was recently re-added to the proposal. I'm wondering what the driving use case is for that attribute. I can see from the explainer that opening a popup on "load" is listed there. Is that it?
An easy alternative to the "open" attribute, for that use case, is:
window.onload=()=>{myPopup.show();};
I ask because there are complexities:
What if multiple non-nested (or nested!) popups have the "open" attribute?
In this case, only one of them should show, so at least an order needs to be determined. Perhaps the behavior should be as-if the .show() method were called in tree order on all of them?
For the non-shown popups above, should a "hide" event be fired on them?
For the non-shown popups above, should their "open" attribute be removed? If not, then they'll still be wearing the "open" attribute while not actually being displayed. (The UA stylesheet cannot therefore simply use popup:not([open]) {display: none !important;} to hide the popup.)
When an open <popup> is removed from the tree, the <popup> plus all of its non-ancestor <popup>s need to be hidden.
Without the "open" attribute, this is relatively easy, because hiding popups doesn't affect the DOM tree, just the layout tree.
However, when the "open" attribute needs to be removed from each of those hidden popups, this gets more tricky. Node removal (in Chromium, and I think by spec, modulo mutation events) is forbidden from modifying the DOM tree. Therefore, the removal of the "open" attribute would need to be done at a later time (micro-task timing?), which would be observable.
What if a disconnected <popup open> node is created?
Is it confusing that popup.getAttribute('open') is non-null for this disconnected, non-displayed <popup>?
What if this node is appended to the document? Should it act as if .show() were called upon insertion? If so, some of the same concerns as #2 above apply here - other <popup>s will need to be hidden as this node is inserted into the document.
All of the above can be overcome, but I'm curious if the added complexity is worth the benefit provided by the "open" attribute. I do know that parallelism to <dialog> has been brought up here. But in this case specifically, <dialog> is quite different - many <dialog>s can be open at a time, and they don't close each other. So none of the complexity above applies to <dialog>.
The text was updated successfully, but these errors were encountered:
The "open" attribute was recently re-added to the proposal. I'm wondering what the driving use case is for that attribute. I can see from the explainer that opening a popup on "load" is listed there. Is that it?
An easy alternative to the "open" attribute, for that use case, is:
I ask because there are complexities:
.show()
method were called in tree order on all of them?popup:not([open]) {display: none !important;}
to hide the popup.)<popup>
is removed from the tree, the<popup>
plus all of its non-ancestor<popup>
s need to be hidden.<popup open>
node is created?popup.getAttribute('open')
is non-null for this disconnected, non-displayed<popup>
?.show()
were called upon insertion? If so, some of the same concerns as #2 above apply here - other<popup>
s will need to be hidden as this node is inserted into the document.All of the above can be overcome, but I'm curious if the added complexity is worth the benefit provided by the "open" attribute. I do know that parallelism to
<dialog>
has been brought up here. But in this case specifically,<dialog>
is quite different - many<dialog>
s can be open at a time, and they don't close each other. So none of the complexity above applies to<dialog>
.The text was updated successfully, but these errors were encountered: