Hacker News

Favorites Setup
Comment by doginasuit | original | HTML Can Do That
[−]doginasuit · 2026-08-20 Thu 21:17 UTC · link
> The only hard thing is still to position a popover near the element that triggers it, such as when you want to create a context menu that has to render above/below the button that triggered it.

If you put something like this in your popover class, it will resolve to the button that called it when position-anchor is not set:

top: anchor(bottom);

I'm not sure how widely supported it is but I've been using it in Firefox/Chrome.

[−]extra88 · 2026-08-21 Fri 00:23 UTC · link
All current browsers support anchor positioning including popover buttons being the implicit anchor. However, the anchor positioning polyfill does not support this, it requires an explicit anchor-name.