Before anyone wastes a lot of time like I did trying to use the popover API: it is not ready yet. You can do very basic things in all browsers but positioning is still different and/or totally broken per browser.
As for positioning, there is an experimental feature @position-try. Here I made a small demo where it handles overflows.
https://waspdev.com/articles/2025-06-29/css-features-web-dev...
But yeah, that's kind of limited if you need nice animations or some other complicated thing. Although it's fun.
In the meantime, there is a polyfill to load in browsers without support.