Closed mfreed7 closed 1 year ago
I just realized that this naming clashes with window.open()
's popup
feature as I initially thought this was about the new API for window.open()
that we've been discussing. Perhaps it's enough if we can refer to this as viewport popups or some such, or perhaps we need slightly different name.
Yep, that’s unfortunate. More so because I worked on both of them, and should have thought of this potential confusion earlier. We are anyway bikeshedding the attribute name, so perhaps add your thoughts there?
Ok, per the triage meeting, my action item was to organize and summarize the open issues for Popup. Hopefully this helps:
Behavior:
Bikeshedding:
Documentation / spec:
Resolved, just needs implementation/testing:
Relationships to other APIs:
Other:
Quick update on this thread: the feedback from the HTML spec triage meeting on April 7 was that there were too many open issues for Pop-Up, and we should work to resolve them. OpenUI has been hard at work for the last 4 months discussing those issues and proposing ways forward. As of today, the open issues have been reduced to these 7 issues. The complex issues (see bigger list above, or this list of resolved issues) have been discussed at length and resolved (in the OpenUI sense), and the remainder are what I'd consider to be smaller issues. They still need a resolution, but I'm fairly confident we're on a path to that soon.
@josepharhar has been hard at work on a draft spec PR that explains all of the behaviors of the Pop-Up API, as designed and discussed within OpenUI. Stay tuned!
I have opened a PR: https://github.com/whatwg/html/pull/8221
I just wanted to give a quick status update:
Generally, we're looking for feedback and input for this feature, to make sure it works as expected, solves the problems it is trying to solve, and plays nicely with the rest of the platform. Thanks in advance!
One problem I noticed is that the spelling conflicts with https://whatwg.org/style-guide. We have popup as a non-hyphenated-all-lowercase word.
The explainer also doesn't cover IDL attributes for the other attributes, such as defaultopen
.
One problem I noticed is that the spelling conflicts with https://whatwg.org/style-guide. We have popup as a non-hyphenated-all-lowercase word.
I believe "pop-up" was decided here: https://github.com/openui/open-ui/issues/546#issuecomment-1156988124
@domenic do you have any thoughts about the style guide dictionary?
E.g., we spell it allow-popups-to-escape-sandbox
not allow-pop-ups-to-escape-sandbox
. I think it would be confusing if we did something else here. It's also confusing that it reuses the term to mean something completely different, of course.
I didn't realize we had existing web-developer-exposed uses of the word popups on the web platform. I don't have any guidance on how to resolve that. Maybe go back to my suggestion of a toplayer=""
attribute.
@josepharhar the PR isn't really reviewable for me anymore through GitHub's UI. Perhaps you can squash the commits and force push?
Also, if there's some more history around why a CSS property was not the solution for this feature that would be appreciated. The summary seems to be that it would require some scripting and that there's a conflict with dialog
and Fullscreen, but not a lot of details around that are provided. And in particular it seems that rendering would end up relying on CSS anyway.
the PR isn't really reviewable for me anymore through GitHub's UI. Perhaps you can squash the commits and force push?
I merged with the latest tip of main, how does it look now? I can also squash all the commits into one but then github won't show me what lines all of the previous comments were made on, which is still helpful to me.
Also, if there's some more history around why a CSS property was not the solution for this feature that would be appreciated.
I believe these issues contain discussion about this: https://github.com/w3c/csswg-drafts/issues/6965 https://github.com/openui/open-ui/issues/410 https://github.com/openui/open-ui/issues/417
I strongly suspect some amount of squashing is needed to resolve that, but you don't have to squash all I think.
Thanks for the pointer to the CSS WG issue, I think that explains it best.
https://github.com/w3c/csswg-drafts/issues/7319 also seems relevant here. Left a comment there about naming the pseudo-classes consistently with the API.
Thanks for the pointer to the CSS WG issue, I think that explains it best.
There’s also this whole document that goes through the alternatives considered, including the linked section about a CSS property.
Yeah, that is actually what prompted me to ask for more details. 😊
Yeah, that is actually what prompted me to ask for more details. 😊
Oh ok! Well then I’m glad https://github.com/w3c/csswg-drafts/issues/6965 also helped. Perhaps I should link to that issue from the alternative doc.
I strongly suspect some amount of squashing is needed to resolve that, but you don't have to squash all I think.
Ah I see I was able to reproduce the same error. I squashed everything down to one commit and it looks like it is working now!
Yeah, that is actually what prompted me to ask for more details. 😊
Oh ok! Well then I’m glad w3c/csswg-drafts#6965 also helped. Perhaps I should link to that issue from the alternative doc.
E.g., we spell it
allow-popups-to-escape-sandbox
notallow-pop-ups-to-escape-sandbox
. I think it would be confusing if we did something else here. It's also confusing that it reuses the term to mean something completely different, of course.
So the proposed content attribute is called popup
, which would seem to align very well with allow-popups
, allow-popups-to-escape-sandbox
, and window.open(..,..,"popup")
, right? And those are the only three API uses of the word "popup" in the spec, correct? To me at least, all of those feel very natural and consistent, from a developer's point of view. Would you disagree? Is the issue just the prose usage of the word "pop-up"? Or perhaps the capital "U" in the IDL attribute popUp
? I'm trying to understand where you think the issue (for the developer) really lies, so we can find an appropriate solution. I don't think renaming to "top-layer" is a solution (for developers) because developers don't know what a "top layer" is. They definitely do know what a "pop-up" or "popup" is. I think picking a slightly different name (e.g. "popover") is also more confusing to developers, since there are then two names for roughly the same concept. Searching for answers becomes harder when there are two words for "things that pop up".
Yeah, the IDL attribute would have to be popup
. It still strikes me as somewhat bad to have a feature that conflicts in name so heavily with an already existing feature. E.g., in #7485 window.openPopup()
was proposed.
Yeah, the IDL attribute would have to be
popup
. It still strikes me as somewhat bad to have a feature that conflicts in name so heavily with an already existing feature. E.g., in #7485window.openPopup()
was proposed.
Right - so as I think you know, an IDL attribute called popup
(lowercase "u") is not web compatible: https://github.com/openui/open-ui/issues/546
Can you elaborate on why this is "heavy conflict" between popup
and popUp
and "pop-up"? I.e. I assume you are anticipating some kind of developer confusion around this - would you help me understand what that might be? I.e. the concept is called a "pop-up" (with or without the dash) for developers, and when they go to use this API, they'll invariably start typing "pop" and find what they need pretty quickly. I'd anticipate much greater confusion if they are looking for how to make a "pop-up" and end up finding the attribute called toplayer
.
I thought @annevk's concern was not with the hyphen vs. not, but with the idea that "popup" as it is today exposed to web developers, means a new Window object created by window.open() or target=_blank. I had previously thought that we only used the term "popup" for those informally or in spec prose, but he pointed out that we actually use it in exposed APIs.
So indeed, it seems unfortunate if, e.g., sandbox without allow-popups set, still allows popup="" attributes in the sandboxed iframe, due to the fact that popup="" is reusing the term "pop(-)up" for something different than what it's meant in web APIs so far.
Yeah, I think both are problematic.
(I'm also not really sure why you are asking me to defend consistent naming. It's an established principle.)
(I'm also not really sure why you are asking me to defend consistent naming. It's an established principle.)
Ironically, I think we're hitting an issue where we're all going for consistent naming here, you all with HTML and us with what component libraries and design systems used and voted for.
I'm going to be honest that I don't think there is a good solution here because I see cons in both directions as you all have pointed out in the confusion of allow-popups
but popup
still works; and Open UI not naming it something that does not align with what devs/designers refer to them as.
@mfreed7 I think it's worth raising this with the group to get discussion going, as noted above these are valid concerns and I think it's worth the group coming to some alignment that takes these specific collisions into account.
Yeah, I think both are problematic.
(I'm also not really sure why you are asking me to defend consistent naming. It's an established principle.)
I'm totally supportive of consistent naming, because it helps developers reason about the platform. It's a good thing when developers can follow a pattern and get good results, and not have to search for the right property or function to use. I'm not supportive of consistent naming just for theoretical purity, if it conflicts with the interests of developers. And we should all acknowledge that there are grey areas where judgement is needed. I believe this is one of them.
Currently, developers call these things "popups" or "pop-ups". They don't call them "top layers". And that applies to things opened by both window.open
and the new pop-up API: both are regions of content that "pop up" on top of the other content. Yes, there are differences between them, such as whether they escape iframe bounds or the browser window. But I also don't think they're completely different things, just nuanced versions of the same general idea. Having two names for one general idea sounds confusing to developers.
As for consistent property naming, I don't see a difference between <div popup>
and window.open(..,..,"popup")
and `
We can, of course, rename the feature. And teach developers to use the new name for this kind of pop-up, and the word "popup" for the other kind of pop-up. I just want to make sure we're doing it to benefit developers, and not to benefit the purity of the spec. So I asked about the motivation for changing the name.
We can, of course, rename the feature. And teach developers to use the new name for this kind of pop-up, and the word "popup" for the other kind of pop-up. I just want to make sure we're doing it to benefit developers, and not to benefit the purity of the spec. So I asked about the motivation for changing the name.
I 100% agree with this sentiment. The Open UI calls are open to anyone; we'll discuss this next week - anyone on this thread is welcome to attend
See https://github.com/MicrosoftEdge/MSEdgeExplainers/issues/438 for the initial naming issue, which then continued over in https://github.com/openui/open-ui/issues/296.
See MicrosoftEdge/MSEdgeExplainers#438 for the initial naming issue, which then continued over in openui/open-ui#296.
Thanks, I meant to post that context.
@gregwhitworth has opened https://github.com/openui/open-ui/issues/627 in OpenUI so we can brainstorm a new name.
@annevk I'm really hoping you might have a chance to take a look at the rest of this feature (besides the name), to see if there are any other major changes needed. It'd be helpful to the folks testing the feature to have all of the breakages happen at the same time. Not required, of course, it's just a prototype. But immensely helpful.
As a pre-check, here's a list of the names we've already discussed for this feature. It's very likely we'll go back to this list to pick a new name. Should any of these be ruled out for spec/conflict reasons?
So the OpenUI just discussed the renaming of this feature. We had some good debate centering on developer understanding of the feature and general ergonomics, and we resolved to rename the entire feature to popover
(one word).
I am going to move forward with the rather large task of renaming everything from popup
to popover
now, and get the web compat checks started for that new name, which will take several months.
I would very much appreciate a few things from the WHATWG here:
popover
, and its associated uses (e.g. .showPopover()
, popovertoggletarget
, popoverhide
, etc.). @annevk @domenic Thanks!
Thanks for working on that!
My remaining bigger concerns are:
It's weird that defaultopen=""
is named generically but only applies to popover=""
elements, not e.g. <details>
, <dialog>
, or (perhaps) <select>
. Perhaps it should be called popoverdefaultopen=""
.
I'm also slightly concerned about the the anchor=""
attribute. Although it's not as confusing (versus defaultopen=""
which seems like it should be related to existing open=""
attributes), perhaps it should be popoveranchor=""
.
I am pretty concerned about the (ab)use of event listener mechanisms in the spec. This is less likely to result in highly-breaking changes, but might need the most spec work, so let me explain it in more detail.
About event listeners: event listeners are generally meant for use by author code, not other specifications. See e.g. some discussion in https://github.com/whatwg/html/pull/8382#issuecomment-1279929852 about an analogous case. Also note that document.open()
will clear all event listeners, which might not be what you want.
I don't have any good suggestions though on the correct path, and if I recall correctly @annevk feels more strongly about this sort of events layering issue than I do, so I'd prefer to take any suggestions from him. In other words, I'm just looking for something that meets these requirements:
@annevk is happy
There are no weird observable consequences of using the event listener infrastructure. Such as (but not limited to):
document.open()
breaking all popoversdocument.onpointerdown = e => e.preventDefault()
document.body.dispatchEvent(new PointerEvent("pointerup"))
(or perhaps worse, document.body.dispatchEvent(new ProgressEvent("pointerup"))
).<dialog>
element works more generically)My brief skim of the current setup in https://github.com/whatwg/dom/pull/1117 is that it avoids some of these problems, but not all. Tests for them would also be good, as IIUC Chromium's implementation might be done via actual event listeners, which do hit all of the above problems.
My remaining bigger concerns are:
Awesome, thanks for the detailed list!
- It's weird that
defaultopen=""
is named generically but only applies topopover=""
elements, not e.g.<details>
,<dialog>
, or (perhaps)<select>
. Perhaps it should be calledpopoverdefaultopen=""
.
So @annevk actually opened https://github.com/openui/open-ui/issues/500 because he wanted an "easier" name. We ended that discussion resolving on defaultopen
. We can re-open it if you feel strongly. Quite a bit of the discussion centered on this being a semi-common pattern, so perhaps another alternative is to generalize defaultopen
to apply to more things? Off hand, I don't have specific suggestions though. Basically, let me know what you think (you too, @annevk), and then I can re-open the bikeshed for defaultopen
with your input.
- I'm also slightly concerned about the the
anchor=""
attribute. Although it's not as confusing (versusdefaultopen=""
which seems like it should be related to existingopen=""
attributes), perhaps it should bepopoveranchor=""
.
Here, the anchor
attribute definitely wants to be general. This is, first and foremost, a hook into the Anchor Positioning feature's implicit anchor element concept. It allows HTML-based connections between the anchored element and the anchor. In the case of popovers, this anchor connection also naturally sets up a relationship between nested popovers. But the attribute, I think, really should be general purpose. Would you agree? If needed, we could split that part out of this PR, but then this PR would be dependent on that one, so I'd hope we could get it landed first.
- I am pretty concerned about the (ab)use of event listener mechanisms in the spec. This is less likely to result in highly-breaking changes, but might need the most spec work, so let me explain it in more detail. {...} My brief skim of the current setup in whatwg/dom#1117 is that it avoids some of these problems, but not all. Tests for them would also be good, as IIUC Chromium's implementation might be done via actual event listeners, which do hit all of the above problems.
These are definitely all things I'd be concerned about, so I appreciate the detailed input! I'd love to hear more from @annevk in terms of suggestions for improvement. In the meantime, I'll work on adding test cases for the problem scenarios you listed.
So @annevk actually opened openui/open-ui#500 because he wanted an "easier" name. We ended that discussion resolving on
defaultopen
Well, (a) that discussion was about "initially" vs. "default", not about prefixes; (b) that discussion was for the <popup>
API, not for the attribute-based version.
So I would think we should either have defaultopen=""
be generic (i.e., apply at least to <details>
and <dialog>
as well, with well-defined interaction with their open=""
attributes) or it should be namespaced with a prefix.
But the attribute, I think, really should be general purpose. Would you agree? If needed, we could split that part out of this PR, but then this PR would be dependent on that one, so I'd hope we could get it landed first.
If things work out like you predict, then keeping it general makes sense. However, what I worry about is a future where CSS anchored positioning evolves away from a HTML attribute-based design, or never ends up shipping, or similar. Then we will be stuck with an anchor=""
attribute in the spec, which only applies to popovers.
My understanding is that implementation interest and activity is higher for popover than for anchored positioning. If that is correct, I think the ideal sequence would be for popover to be specified (and shipped) with zero interaction with any anchor-related stuff. Then, later, when we have implementation interest and imminent shipping for anchor positioning, we'd send a separate PR to HTML to add it, including modifications to the popover spec.
Well, (a) that discussion was about "initially" vs. "default", not about prefixes; (b) that discussion was for the
<popup>
API, not for the attribute-based version.
True.
So I would think we should either have
defaultopen=""
be generic (i.e., apply at least to<details>
and<dialog>
as well, with well-defined interaction with theiropen=""
attributes) or it should be namespaced with a prefix.
Any preferences? I think mine would be to make defaultopen
generic, but how much (spec) work do you think that would be? For now, it sounds like the list of elements is <details>
and <dialog>
, plus the popover
attribute. And most of the effort would be defining the timing, which would be good to do for popover anyway. Thoughts?
But the attribute, I think, really should be general purpose. Would you agree? If needed, we could split that part out of this PR, but then this PR would be dependent on that one, so I'd hope we could get it landed first.
If things work out like you predict, then keeping it general makes sense. However, what I worry about is a future where CSS anchored positioning evolves away from a HTML attribute-based design, or never ends up shipping, or similar. Then we will be stuck with an
anchor=""
attribute in the spec, which only applies to popovers.My understanding is that implementation interest and activity is higher for popover than for anchored positioning. If that is correct, I think the ideal sequence would be for popover to be specified (and shipped) with zero interaction with any anchor-related stuff. Then, later, when we have implementation interest and imminent shipping for anchor positioning, we'd send a separate PR to HTML to add it, including modifications to the popover spec.
I'm definitely ok splitting out anchor
from this PR, and landing it as a separate PR for anchor positioning and the tie-in to popover, once anchor positioning reaches WD (or CR?). @josepharhar WDYT? Mind pulling anchor
out of the PR?
Any preferences? I think mine would be to make
defaultopen
generic, but how much (spec) work do you think that would be? For now, it sounds like the list of elements is<details>
and<dialog>
, plus thepopover
attribute. And most of the effort would be defining the timing, which would be good to do for popover anyway. Thoughts?
I lean toward making it popover-specific, because I think defining the interaction between open=""
and defaultopen=""
might be confusing. (E.g., should open=""
also work with popover=""
? What if defaultopen=""
is specified but open=""
is not? What about vice-versa?) But if you have a concrete proposal for how they should interact, then maybe it'll work out fine.
In the PR I have renamed from popup to popover and I have removed the anchor attribute
Ok, I've added tests, here in Chromium, soon upstreamed to WPT.
document.open()
breaking all popovers
Since document.open()
wipes out all Nodes, including any potential popovers, I think the only concerns here are implementation ones, like memory leaks. Is there a way to call document.open()
without that being the case? Perhaps I'm missing something.
- Popover logic executing before some author code and after other author code (e.g. capturing vs. non-capturing listeners)
I added a test that capturing cancel
/finish
listeners can't re-add another animation and keep the popover waiting. Are there other cases you're worried about?
- Popover logic being subject to interference with
document.onpointerdown = e => e.preventDefault()
I added tests to verify that cancelling pointerdown
/pointerup
/mousedown
/mouseup
events doesn't break/prevent light dismiss on click.
- Popover logic being subject to triggering using
document.body.dispatchEvent(new PointerEvent("pointerup"))
(or perhaps worse,document.body.dispatchEvent(new ProgressEvent("pointerup"))
).
So this is two things:
pointerup
event to trigger light dismiss behaviors. Can you help me understand why we don't want to allow this? It feels convenient for developers. It's easy to disallow it, I just want to understand why.ProgressEvent
) from triggering light dismiss. I added a test case for this.
- Popover dismiss logic only being doable using the Esc key, and not other close signals (compare to how the
<dialog>
element works more generically)
So adding tests for this gets tough, right? I.e. <dialog>
is only tested with ESC, unless I missed a test. There are .tentative
tests that test it with CloseWatcher, and I plan to add support for that to popover. But it's not a landed spec, right?
If you were suggesting with this point that the spec PR be changed to make it more like <dialog>
, and leave it "vague" about how the UA does that, I'm ok. But I do think the language should be stronger than <dialog>
: Escape and similar close signals should always trigger the light dismiss behavior, vs. "may trigger".
I lean toward making it popover-specific, because I think defining the interaction between
open=""
anddefaultopen=""
might be confusing. (E.g., shouldopen=""
also work withpopover=""
? What ifdefaultopen=""
is specified butopen=""
is not? What about vice-versa?) But if you have a concrete proposal for how they should interact, then maybe it'll work out fine.
Ok, fair enough. There are definitely a number of open questions there, so perhaps this is not the time to open that can of worms. I've opened https://github.com/openui/open-ui/issues/631 to bikeshed a new name for this attribute.
Since
document.open()
wipes out all Nodes, including any potential popovers, I think the only concerns here are implementation ones, like memory leaks. Is there a way to calldocument.open()
without that being the case? Perhaps I'm missing something.
What I am worried about is using document.open()
to wipe out all event listeners, including the one that handles light dismiss behaviors. Then, you add a new popover=""
element. And light dismiss fails to work for it.
I added a test that capturing
cancel
/finish
listeners can't re-add another animation and keep the popover waiting. Are there other cases you're worried about?
I'm worried about the sequence between these three things: non-capturing author listeners, capturing author listeners, and light dismiss behaviors. Light dismiss behaviors should not be between these two; they should be after both, I believe.
- Can you help me understand why we don't want to allow this? It feels convenient for developers. It's easy to disallow it, I just want to understand why.
Dispatching events isn't a mechanism for causing things to happen. It's a mechanism for notifying about something that already happened. See https://dom.spec.whatwg.org/#action-versus-occurrence .
So adding tests for this gets tough, right? I.e.
<dialog>
is only tested with ESC, unless I missed a test. There are.tentative
tests that test it with CloseWatcher, and I plan to add support for that to popover. But it's not a landed spec, right?
Yeah, this is more of a spec concern. Note how <dialog>
is currently specced, which makes no reference to specific keys or input modalities.
Before we take this back to openui again, can we just take a beat and be sure that's the right thing to do - or at least be clear as possible about the feedback and parameters? It seems to me that quite a lot of thought and rationale and reflection (and input from several channels) has gone into creating a name/patten that many of us like to use as more generic idea - I believe some recent aria work has even adopted that idea. To me that implies that we'd like consistency (I would!) and it seems like making it specific doesn't do favors to our future selves... it kind of seems to make that goal even harder in my mind.
Throughout, it also seems to me @domenic has expressed his concerns on this rather mildly 'I lean slightly' or (in a linked issue) 'I think I'm agnostic.' Yes, there is currently an unxplained disconnect between open as used by two elements and a new concept of default open - but what is the real feedback here? I can kind of interpret this a few ways and it seems silly to keep bouncing between the groups without a clearer set of parameters.
Like, It seems to me not that hard to explain the relationship conceptually of defaultopen and open if we needed to. Do we? Would that resolve this? Is it necessary initially? I'm not sure? Are their concepts of 'open' the same enough? Or is it potentially overloading the term in a way that is problematic? Would a new attribute name that was also global but still generic resolve this (initiallyopen
was suggested at some point, but I explained why that pattern is less ideal to me than default if we imagine setting some useful precedent here)? I'm not sure how it would because the relationship to open still seems to apply.
Idk, I guess what I am getting at is... can you help us understand some more discrete options/parameters?
What I am worried about is using
document.open()
to wipe out all event listeners, including the one that handles light dismiss behaviors. Then, you add a newpopover=""
element. And light dismiss fails to work for it.
Ahh, ok. I'll add a test for this. This can't happen with at least the Chromium implementation, since light dismiss isn't actually implemented using event listeners. Perhaps that indicates an issue with how we've written up this part of the spec? Here's the Chromium code - light dismiss behavior happens just before events are fired. Is there a more standard way to spec this timing?
I'm worried about the sequence between these three things: non-capturing author listeners, capturing author listeners, and light dismiss behaviors. Light dismiss behaviors should not be between these two; they should be after both, I believe.
So as implemented, and as desired (I think!), light dismiss behaviors come before event listeners (capturing or non-capturing). This makes them not-developer-cancelable, so that the light dismiss is guaranteed to happen. We discussed this behavior several times, first resolving that neither show/hide should be cancelable, then lightening the restriction on show but leaving hide non-cancelable. The concern is that the management of popovers is complex, particularly in nested cases and eventually when popover=hint
is added back, and there are too many footguns present if the developer can cancel the hiding of a popover. For the same reasons, it seems to me that light dismiss (another way popovers get hidden) should have the same non-cancelable behavior. Thoughts?
Dispatching events isn't a mechanism for causing things to happen. It's a mechanism for notifying about something that already happened. See https://dom.spec.whatwg.org/#action-versus-occurrence .
Ahh, thanks for the link. Ok, makes sense to me. I'll modify the behavior to only trigger via trusted events, and add tests for this. @josepharhar we need to add this to the spec PR, probably.
Yeah, this is more of a spec concern. Note how
<dialog>
is currently specced, which makes no reference to specific keys or input modalities.
Ok, that makes total sense to me. @josepharhar another spec change here.
Ahh, ok. I'll add a test for this. This can't happen with at least the Chromium implementation, since light dismiss isn't actually implemented using event listeners. Perhaps that indicates an issue with how we've written up this part of the spec? Here's the Chromium code - light dismiss behavior happens just before events are fired. Is there a more standard way to spec this timing?
This looks solid! I think we're on the right track. I believe an earlier version of Joey's spec might have used event listeners, or have used language that an implementer might mistake for being event listener based, so that's what I wanted to guard against. His latest work in https://github.com/whatwg/dom/pull/1117 does not use event listeners, and avoids the problem.
For the same reasons, it seems to me that light dismiss (another way popovers get hidden) should have the same non-cancelable behavior. Thoughts?
Sounds good to me! I should have been clearer I didn't really know whether "before" or "after" was more correct; I was just pretty sure that "in between" was incorrect. If the choice of "before" is deliberate then let's go with that.
I'm not fully sure that matches what's specced in https://whatpr.org/dom/1117/bf5f6c2...f4cef07.html , in particular the way that the light dismiss call is done as part of a loop implies that there will be a sequence like: light dismiss, capturing, light dismiss, capturing, light dismiss, capturing. But I haven't looked at the details of exactly what that loop is covering...
Popover dismiss logic only being doable using the Esc key, and not other close signals (compare to how the
So adding tests for this gets tough, right? I.e.
Yeah, this is more of a spec concern. Note how
Ok, that makes total sense to me. @josepharhar another spec change here.
So is the idea to replace the entire light dismiss integration/implementation in the spec with some text like canceling-dialogs that just says something along the lines of "user agents may provide a user interface that, upon activation, closes all open popovers"? (I'm ok with that, just want to make sure - that would also mean getting rid of the DOM PR)
So is the idea to replace the entire light dismiss integration/implementation in the spec with some text like canceling-dialogs that just says something along the lines of "user agents may provide a user interface that, upon activation, closes all open popovers"?
To be clear, we want to have the triggering condition be vague (for now, until https://wicg.github.io/close-watcher/#close-signals gets merged into HTML). But the triggered action needs be detailed and precise. So if "closes all open popovers" is a detailed algorithm, then this sounds like the right track.
(I'm ok with that, just want to make sure - that would also mean getting rid of the DOM PR)
I wasn't intending that we get rid of all of the DOM PR. Only the Esc key handling portion. I think the pointerup and pointerdown handling is still good as-is.
I wasn't intending that we get rid of all of the DOM PR. Only the Esc key handling portion. I think the pointerup and pointerdown handling is still good as-is.
Ok, I replaced the Esc key part with a paragraph modeled after canceling-dialogs. How does it look?
I lean toward making it popover-specific, because I think defining the interaction between
open=""
anddefaultopen=""
might be confusing. (E.g., shouldopen=""
also work withpopover=""
? What ifdefaultopen=""
is specified butopen=""
is not? What about vice-versa?) But if you have a concrete proposal for how they should interact, then maybe it'll work out fine.Ok, fair enough. There are definitely a number of open questions there, so perhaps this is not the time to open that can of worms. I've opened openui/open-ui#631 to bikeshed a new name for this attribute.
I just wanted to come back here with the results of https://github.com/openui/open-ui/issues/631. We resolved today to drop the defaultopen
functionality and attribute entirely. There was fairly strong pushback to something like popoverdefaultopen
primarily because it feels like the wrong direction to take the platform. That means anything else that comes along that needs "default open" behavior needs to mint newthingdefaultopen
also. The feeling was that the best would be to go back in time and not add open
to <details>
and <dialog>
and instead provide defaultopen
.
Perhand now that we have :open
and :closed
pseudo classes, most/all of the use cases for the open
attribute can be replaced by those pseudo classes and the existing hooks to trigger changes, for <dialog>
and <details>
, and we could think about introducing a generic defaultopen
attribute and simultaneously deprecating the open
attribute. That would, for example, allow us to remove the giant note for <dialog>
that basically says "please don't touch the open
attribute".
This is a long winded way of saying: we're removing defaultopen
from this PR. @domenic I'd love to hear your thoughts before I go ahead and open a WHATWG issue to discuss the above.
Removing complexity from popover is always welcome to me.
I think open
on <dialog>
and <details>
are nice. I don't recall all the discussions on why popover did not follow that model, but I don't think we should change them or try to deprecate them. I think we can fix open
on <dialog>
; there's an open issue tracking that: https://github.com/whatwg/html/issues/5802
I think
open
on<dialog>
and<details>
are nice. I don't recall all the discussions on why popover did not follow that model, but I don't think we should change them or try to deprecate them. I think we can fixopen
on<dialog>
; there's an open issue tracking that: #5802
So the flavor of issue with Popover is that e.g. popover.remove()
for a popover that has descendent nested popovers will trigger the hiding of those nested popovers before the hiding of popover
. That would, if open
was live, try to remove the open
attribute during the Element removal, which seems bad. At least in Chromium, that (along with firing the associated events) is outlawed. If we just leave the open
attribute on those disconnected popovers, more weirdness happens when you re-insert them into the document.
I see the use case for an "initially open" attribute that shows the dialog or opens the details. That seems to be the predominate use case, right? Can you expand on the use case for needing dialog.setAttribute('open','')
to work, vs. requiring dialog.show()
? Perhaps there would be a need for a details.toggle()
type method, of course, but assuming that was available?
Did you consider popover=open
for initially open?
For animations, is the primary motivation for tackling them the transition out of the top layer? If that applies more generally to elements transitioning out of the top layer, perhaps the integration should happen there and transitioning out of the top layer should be asynchronous operation? cc @heycam
For animations, is the primary motivation for tackling them the transition out of the top layer? If that applies more generally to elements transitioning out of the top layer, perhaps the integration should happen there and transitioning out of the top layer should be asynchronous operation?
Having an explicit API for the author to use to indicate when their animations are done (via providing a Promise?) seems more understandable to me than the automatic capture and comparison of running animations, but you definitely lose the conciseness of just adding a transition on a :open
rule.
Not being able to use transitions on elements that go from display: none
to displayed, and vice versa, seems like a general problem. How do authors solve this now? Should we be trying to solve that generally rather than within popup's show/hide steps?
+1 to a general solution if possible. At least for top layer (i.e., anything done here should work just as well for modal <dialog>
as for popover), but maybe even more generally.
This is quite related to https://github.com/whatwg/html/issues/6349, which was previously discussed in WHATWG. However, over the course of the last year or so, the OpenUI CG has been working through issues and maturing the proposal with the help of great feedback and brainstorming from both developers and implementers. The latest explainer (https://open-ui.org/components/popup.research.explainer) has changed the shape of the API from a new element (
<popup>
) to a content attribute (popup
), and has changed several of the details, primarily to improve accessibility and broaden the applicability of the API.Importantly, the OpenUI group resolved that this proposal looks good enough to start prototyping. I have started that process for Chromium.
While there are still many open issues that we're working through, I think the shape of the API is in a good enough shape to bring before WHATWG for implementer interest and (importantly!) input / feedback / guidance. Hence this issue.
For convenience, here are the background and goals sections from the explainer:
Background
There is a need in the Web Platform for an API to create "popup UI". This is a general class of UI that always appear on top of all other content, and have both one-at-a-time and "light-dismiss" behaviors. This document proposes a set of APIs to make this type of UI easy to build.
Goals
Here are the goals for this API: