Live data from Hacker News

Popover API

developer.mozilla.org

111–120 of 166 posts

Re: Popover API

#112
post #99
post #91

Earlier quoted context omitted.

I'm seeing a lot of this kind of comment, but it's a bit non-sensical. You can implement pop-overs currently using existing 's and such; e.g.: https://getbootstrap.com/docs/5.3/components/popovers/ All this means is that you can implement popovers without having to include a magic extra library. All blocking an explicit "popover" element would do is cause people to stick with custom libraries.

I generally agree with you, but one factor is the ability to filter out scripts using browser plugins. For example, if a page has 3rd-party scripts that trigger obnoxious modals, I can use NoScript to prevent those scripts from executing. If it doesn't require scripts to open the modals, would it shift the burden to adblockers, and start another competition in which the site and the adblocker are trying to get around…

Obnoxious modals with ads would still download the content dynamically with JS so the NoScript would still do the job.

Re: Popover API

#113
post #99
post #91

Earlier quoted context omitted.

I'm seeing a lot of this kind of comment, but it's a bit non-sensical. You can implement pop-overs currently using existing 's and such; e.g.: https://getbootstrap.com/docs/5.3/components/popovers/ All this means is that you can implement popovers without having to include a magic extra library. All blocking an explicit "popover" element would do is cause people to stick with custom libraries.

I generally agree with you, but one factor is the ability to filter out scripts using browser plugins. For example, if a page has 3rd-party scripts that trigger obnoxious modals, I can use NoScript to prevent those scripts from executing. If it doesn't require scripts to open the modals, would it shift the burden to adblockers, and start another competition in which the site and the adblocker are trying to get around…

I still don't think there's any significant difference. You can create popover elements without JavaScript, but you can also create divs with a high z-index without JavaScript. You can toggle popover visibility via CSS or click without JavaScript, but you can also do that with divs and a checkbox.

Re: Popover API

#114

Earlier quoted context omitted.

This is not a pop-up. People hate popups because they're intrusive and have their own window. This API replaces div modals and saves time and code for developers.

They're basically the same. Browsers started blocking popups because they were almost always misused. Pop-overs took their place because they're somewhat less trivially blockable.

The big difference is that there are very few valid use cases for popups, but many useful ones for popovers.

Re: Popover API

#115
post #48

I suspect this isn't going to get major usage. Making it a dedicated API makes these things easier to target by extensions and thus easier to block. There are legitimate usages but almost all of the ones I encounter are marketing call to actions and invasive support chat boxes which are both almost universally hated and would the target of those blocking action.

What about cookie consents?

Very much a anti-pattern. The entire concept of these is malicious compliance against the GDPR and not something that the GDPR requires.

Re: Popover API

#116
This seems to be modelled after Sciter's popups that existed 10 or so years.

anchorElement.popup(elementToPopup, options) - https://docs.sciter.com/docs/DOM/Element/#popup

In Sciter popup element is always associated with its anchor element and appears relative to it.

CSS was expanded to support popups: :popup state flag/selector is "on" the popup element and :owns-popup is "on" on popup anchor element when the popup is shown. Also several CSS properties: popup-position, popup-anchor-reference-point, popup-reference-point, popup-animation.

Sciter has built-in JSX and so element.popup() accepts JSX that creates popup DOM element on demand, for example this

   button.onclick = function() {
      button.popup(
        A
        B
        C
      )
   }
will popup selectable list as dropdown popup.

Re: Popover API

#117

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.

The original pop-up implementation (which pop-up blockers aim to prevent) breaks the application content/OS boundary, this does not.

You don’t want that boundary to be broken, because that makes for less usable and less safe systems.

Re: Popover API

#118

Another extremely useful feature that won’t work for our Safari users with any older than 1 year old iPhones and means for the next five years we have to support both this API and a full-blown polyfill or alternative implementation.

Ignorance, or just anti-Apple lies? This is pure misinformation and hurts web development.

Re: Popover API

#120
post #101

Earlier quoted context omitted.

The title attribute is not accessible, so its use is generally discouraged as an accessible label because screen readers can't pick it up (it's fine to use if you combine it with aria-label). Also, you can only show text in a title attribute, so the Popover API would allow you to add rich content to a tooltip (for better or worse :)) Edit: Remove extra "if"

Why "can't" (won't) screen readers pick up the title attribute?

They do pick up the "title" attribute sometimes and apply it as a label. But it's not really the same as being able to keyboard navigate to the browser-generated tooltip.
Post reply on HN