Skip to content
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

The Popover API #74

Closed
mfreed7 opened this issue Oct 14, 2022 · 9 comments
Closed

The Popover API #74

mfreed7 opened this issue Oct 14, 2022 · 9 comments
Labels
from: Google Proposed, edited, or co-edited by Google. from: Microsoft Proposed, edited, or co-edited by Microsoft. position: support topic: html Spec relates to HTML (Hypertext Markup Language) topic: markup Spec relates to markup: elements, attributes, etc topic: web apis Spec relates to web APIs (entry points for script) venue: Open UI CG venue: WHATWG HTML Workstream

Comments

@mfreed7
Copy link

mfreed7 commented Oct 14, 2022

Request for position on an emerging web specification

Information about the spec

Design reviews and vendor positions

Bugs tracking this feature

  • WebKit Bugzilla:
  • Radar:

Brief summary of the issue or the subject of the spec.

A very common UI pattern on the Web, for which there is no native API, is "pop up UI" or "pop-ups". Pop-ups are a general class of UI that have three common behaviors:

  1. Pop-ups always appear on top of other page content.
  2. Pop-ups are ephemeral. When the user "moves on" to another part of the page (e.g. by clicking elsewhere, or hitting ESC), the pop-up hides.
  3. Pop-ups (of a particular type) are generally "one at a time" - opening one pop-up closes others.

The Pop-Up API aims to make this type of UI easy to build.

@gsnedders gsnedders added topic: html Spec relates to HTML (Hypertext Markup Language) topic: markup Spec relates to markup: elements, attributes, etc topic: web apis Spec relates to web APIs (entry points for script) venue: WHATWG HTML Workstream from: Google Proposed, edited, or co-edited by Google. from: Microsoft Proposed, edited, or co-edited by Microsoft. venue: Open UI CG labels Oct 15, 2022
@annevk
Copy link
Contributor

annevk commented Oct 19, 2022

As raised in whatwg/html#7785 (comment) I don't think pop-up (with a hyphen) works.

@mfreed7
Copy link
Author

mfreed7 commented Oct 19, 2022

As raised in whatwg/html#7785 (comment) I don't think pop-up (with a hyphen) works.

Thanks for the reply! Let's continue the naming discussion on the PR, and find a good solution.

Would it then be fair to say that once we resolve the naming question, you're supportive of this feature?

@annevk
Copy link
Contributor

annevk commented Oct 19, 2022

No, it's still under discussion.

@mfreed7
Copy link
Author

mfreed7 commented Oct 19, 2022

No, it's still under discussion.

Ok, makes sense, thanks! But in that case, I think we should wait to work on the naming question until you've had a chance to more thoroughly review and discuss the feature. Otherwise, we could spend significant time/effort trying to rename the attribute only to find there are other blockers. Or even find that we need to rename it back, based on later findings.

So please feel free to reach out with other questions!

@annevk
Copy link
Contributor

annevk commented Nov 11, 2022

Colleagues and I had another look and we're quite happy with the recent changes:

  • Consistent naming of attributes (and renaming to popover).
  • No more meddling with the event dispatch algorithm.
  • Reduction of scope around anchor and defaultopen (i.e., tackle those separately).

Also thanks to @domenic for helping flush some of that out.

The main thing we're not quite sure about (but unfortunately also don't have a suggestion for at the moment) is the tight integration with Web Animations for hiding. Is that motivated somewhere and why it doesn't similarly apply to other elements with state transitions?

Other than that we're largely positive on this feature now.

@mfreed7
Copy link
Author

mfreed7 commented Nov 11, 2022

Colleagues and I had another look and we're quite happy with the recent changes:

  • Consistent naming of attributes (and renaming to popover).
  • No more meddling with the event dispatch algorithm.
  • Reduction of scope around anchor and defaultopen (i.e., tackle those separately).

Also thanks to @domenic for helping flush some of that out.

Awesome, thanks for the feedback! I'm glad you're happy with the changes and the general shape of the API. The feedback we've received via the HTML spec PR have been very helpful in general, and has led to most of these changes.

The main thing we're not quite sure about (but unfortunately also don't have a suggestion for at the moment) is the tight integration with Web Animations for hiding. Is that motivated somewhere and why it doesn't similarly apply to other elements with state transitions?

So the animation behavior (discussed at length here) is definitely a cool feature that developers want, and it's something missing from e.g. <dialog>. It is very common on the web for these types of popovers to get animated in and out, because it helps the user understand that something is coming and going, and is less abrupt than simply disappearing. So I'm very supportive of expanding this capability to other situations where possible. One example is <dialog>: that case was mentioned several times on the OpenUI thread. I think it's possible that the approach taken with the popover API could be ported/adopted to <dialog>, but we need to look.

I'm not sure if your question was about the need to animate, or just the particulars of how it works with Web Animations. In case it's the latter, the technical need is to wait (somehow) for animations to complete before hiding the popover and removing it from the top layer. And it's important to also be able to capture existing animations on the element, to avoid waiting for things that weren't triggered by the show/hide action. The most natural way to do both of these seemed to be via the Web Animations API. If there's a better way to do that, I'd love to hear suggestions!

Other than that we're largely positive on this feature now.

Thanks! 🎉

@mfreed7
Copy link
Author

mfreed7 commented Dec 2, 2022

The main thing we're not quite sure about (but unfortunately also don't have a suggestion for at the moment) is the tight integration with Web Animations for hiding. Is that motivated somewhere and why it doesn't similarly apply to other elements with state transitions?

@annevk per my comment just now, we've ripped out the animations stuff from the Popover spec PR. We very much want to support animations for popovers, but we think we can do it a) independently, and b) in a more general way to support things other than popover.

Your comment seemed to indicate that this animations stuff was your last remaining hesitation about this feature. With it gone, would you be willing to officially mark this standards-position as Supportive?

@annevk
Copy link
Contributor

annevk commented Dec 9, 2022

Yeah, although there's still a number of issues with the PR they are relatively minor so I would suggest we label this as "position: support" on December 21.

@hober
Copy link
Member

hober commented Mar 23, 2023

Closing as we've identified our position.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
from: Google Proposed, edited, or co-edited by Google. from: Microsoft Proposed, edited, or co-edited by Microsoft. position: support topic: html Spec relates to HTML (Hypertext Markup Language) topic: markup Spec relates to markup: elements, attributes, etc topic: web apis Spec relates to web APIs (entry points for script) venue: Open UI CG venue: WHATWG HTML Workstream
Development

No branches or pull requests

4 participants