Live data from Hacker News

Popover API

developer.mozilla.org

11–20 of 166 posts

Re: Popover API

#12

> The Popover API provides developers with a standard, consistent, flexible mechanism for displaying popover content on top of other page content. Paywall 2.0?

The lack of this API wasn’t stopping anyone from implementing a paywall.

Re: Popover API

#13
Kinda funny that browsers have built-in pop-up blockers, but then create APIs like this. Yes I know the difference, but still.

I’m old enough to remember the pop-up and pop-under wars of the late 90s and early 2000s.

I guess we won that particular battle, but the war for our attention is far from over.

Re: Popover API

#14

I absolutely see the need for this if implemented in concert with the host OS windowing system, because current popovers must be emulated in a way that does not always work well. For example, a browser-native today will be able to expand beyond the borders of the hosting browser window, so you can don't have to worry about it getting clipped to the window borders, but a fancy emulated select from toolkit like Quasar…

These popovers are just regular DOM nodes styled with regular CSS.

Giving websites a vector to paint outside the designated viewport (except in extremely limited circumstances like alert(), confirm(), [title], , etc.) makes it a lot easier for them to convincingly emulate browser and OS dialogs. It's a massive security risk, I don't think it's worth the limited upside. Concrete example: a page emulating your password manager extension's unlock widget.

Edit: Note that this is not a theoretical concern. Scammers over the years have created extremely convincing fake UI elements, including fake popup windows complete with the browser chrome. They're even draggable. Not being to paint past the viewport boundary is one of very few, if not the only limitation they couldn't get around.

Re: Popover API

#15

Very cool. So if I understand correctly, this doesn’t really introduce any new capability, it just streamlines the need to have a modal div, mask div, container div, and some uncomfortable positioning CSS? It also adds some pseudo classes to simplify styling. I like it.

The API it introduces also allows the control of popover elements’ visible state in the DOM without any javascript.

That is definitely useful.

Re: Popover API

#16

Kinda funny that browsers have built-in pop-up blockers, but then create APIs like this. Yes I know the difference, but still. I’m old enough to remember the pop-up and pop-under wars of the late 90s and early 2000s. I guess we won that particular battle, but the war for our attention is far from over.

I get the gist of what you're saying, but I don't think they're really comparable. Popups spam your OS with trash that impairs your ability to use your machine (at worst). Popover dialogs can be shut down by closing your tab and nothing more. We've also had these style of popovers for a while now because they're generally a really handy way of presenting info. Yeah, they can be used in annoying ways, but there are lots of genuine usecases, like a modal.

Re: Popover API

#17

Very cool. So if I understand correctly, this doesn’t really introduce any new capability, it just streamlines the need to have a modal div, mask div, container div, and some uncomfortable positioning CSS? It also adds some pseudo classes to simplify styling. I like it.

It also allows for the basic functionality without JS (and without overloading a hidden checkbox). I'm not sure how far that will get you so maybe JS will be needed for a styled and animated popover, but no-JS support with focus handled properly is nice.

I want to say there was also accessibility support built in but now I don't see it in the spec. If it handles announcing the elements to accessibility tools like a screen reader that'll really help too, its pretty easy to forget to do it manually.

Re: Popover API

#18

Kinda funny that browsers have built-in pop-up blockers, but then create APIs like this. Yes I know the difference, but still. I’m old enough to remember the pop-up and pop-under wars of the late 90s and early 2000s. I guess we won that particular battle, but the war for our attention is far from over.

I think you're comparing apples with grapples.

A popover is floating element that appears to display a contextual piece of information when required.

What you're mentioning is something completely different.

Re: Popover API

#19
post #11

There is also ( https://developer.mozilla.org/en-US/docs/Web/HTML/Element/di... ) if you want modal dialogs.

As mentioned in the first few paragraphs of TFA.

Re: Popover API

#20

> The Popover API provides developers with a standard, consistent, flexible mechanism for displaying popover content on top of other page content. Paywall 2.0?

The lack of this API wasn’t stopping anyone from implementing a paywall.

> The lack of this API wasn’t stopping anyone from implementing a paywall.

Obviously -- that's inferred by the 2.0.

Post reply on HN