-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
New feature proposal: Popover API #7785
Comments
I just realized that this naming clashes with |
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? |
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: #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 |
I believe "pop-up" was decided here: openui/open-ui#546 (comment) @domenic do you have any thoughts about the style guide dictionary? |
E.g., we spell it |
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 |
@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 |
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.
I believe these issues contain discussion about this: |
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. w3c/csswg-drafts#7319 also seems relevant here. Left a comment there about naming the pseudo-classes consistently with the API. |
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. 😊 |
Oh ok! Well then I’m glad w3c/csswg-drafts#6965 also helped. Perhaps I should link to that issue from the alternative doc. |
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! |
It was [mentioned](whatwg/html#7785 (comment)) that this CSSWG issue was helpful, so this adds a direct link.
|
It was [mentioned](whatwg/html#7785 (comment)) that this CSSWG issue was helpful, so this adds a direct link. Co-authored-by: Mason Freed <masonf@chromium.org>
Calling getAnimations triggers a style change event by spec. Isn't this called at the point when we would need to trigger the style change and pick up the new animation? |
Thanks @flackr - I just verified that at least in Chromium's implementation, it does work correctly for added CSS animations and transitions. |
I have a strawman proposal for generic display none animations at w3c/csswg-drafts#6429 |
I'm not sure, but if every solution constraints the way you can use animations, I don't think we're on the right path. @flackr's work on
No, the popover specification doesn't call this method (and shouldn't, since it's a public API). It does the first part of this method, collecting the |
The forever-running animation, if started before dismissing the popover, would be ignored, because the algorithm for popovers looks only for animations that start right at that time. If an animation was selected that starts at that time and runs too long, then that would be a site bug, and a mistake that developers can make for any animation. Is it any worse of a failure mode for popovers? Perhaps we should think about adding a UA-supplied timeout when the hide is triggered by a UA feature such as modal dialog or fullscreen, to ensure it completes in a reasonable amount of time. |
You're right - the current spec PR doesn't actually do all of the things that getAnimations() does, but it should (though the Chromium implementation does). That’s a spec bug; we'll make that change shortly and then ping this thread - thanks for clarifying. In offline discussions, @domenic raised this question as well: what about animations on elements in the popover subtree but not the popover itself? Why can’t we detect those animations? The answer is that we do detect them. The implementation uses getAnimations({subtree:true}). I think it might be another spec PR bug (or perhaps the same spec bug as I mentioned above); we’ll get it fixed. Thanks Domenic for pointing this out! |
I’d also like to respond to the suggestion that we use a generic transition-to-display:none mechanism for popover exit animations. (aside: such a general mechanism for CSS is a great idea and a lot of developers have asked for it; that is tracked by Rob’s proposal here). If a popover or dialog transitioned only into the display:none state and there were no But popovers allow the developer to close into a non-display:none state, also have these pseudo classes, and utilizes the top layer. So we need to keep it in the top layer during the animation regardless of destination style; if not, during the animation it would:
However, as the spec currently stands, :open is removed at the beginning of the popover dismiss animation, yet the popover remains in the top layer during the animation. Also, during the animation, neither
These changes should address the concerns above (about multiple states/inconsistency), while at the same time providing a cleaner way for developers to target the animation specifically. This is all probably kind of confusing, so let’s look at a sample developer style for open and close animations. Open animation:
What happens on open is:
Close:
What happens:
|
One thing we could do is have the That also addresses the first half of this feedback from @heycam:
|
Next: what about I think we should use the pattern pioneered by Finally: why not view transitions? View transitions are designed for arbitrary DOM changes, and as such have a more complex mechanism for animation setup that works in any situation, but comes at the cost of substantial restrictions to the type of animations that can be applied. For example, Popover entry and exit are animations of a persistent element, and therefore can support any animation supported by existing animation APIs. In addition, since the element is persistent, I think developers would expect these APIs to work. Whereas if we had needed an animation that destroyed one element and created another, but wanted to cross-fade between them, then View Transitions would make more sense. By the way, the feedback raised here was excellent and useful, thanks all! p.s. I also didn’t write this comment (or the several previous) alone, it was written jointly with @flackr and @mfreed7. |
I have removed the animations integration from the PR |
As mentioned above, we've decided to simplify the current popover spec PR by removing the animations stuff for now, while we figure out the best path forward to support popover animations. We'll likely open a fresh issue to tackle that subject, once we've had a chance to give it some thought. |
Thanks, that sounds great! |
Tests: https://wpt.fyi/results/html/semantics/popovers. Additional context: https://open-ui.org/components/popup.research.explainer. Prior PR: whatwg#8221. Closes whatwg#7785.
I couldn't be sure where to write this but I think it would be great if it will be possible to set an element reference for If this is somehow possible already and I missed it in the documents, sorry for that. |
The anchor feature was dropped. |
Or… it was moved to the anchor positioning proposal, so it’s not directly part of popover. When it comes back, it’s very likely to follow the pattern of |
This is quite related to #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:
Include an appropriate user input and focus management experience, with flexibility to modify behaviors such as initial focus.
The text was updated successfully, but these errors were encountered: