⌂ popover placement foldable

Popover API on a foldable

Two popovers over one anchor. The first is left entirely to the user agent, so it gets the default position: fixed; inset: 0; margin: auto and centres in whatever the engine treats as the viewport. The second is anchored with CSS anchor positioning, so it has to follow the button instead.

Fold the device with a popover open and watch the readout and the trace. The trace samples every animation frame, so a reposition during the fold animation is recorded rather than missed between two resize events.

Both are auto popovers, so they are mutually exclusive: opening one closes the other, by spec. The trace shows the close as it happens.

Centred, UA default

No author positioning at all. It centres in the viewport the engine reports.

Anchored, CSS anchor positioning

position-anchor plus top: anchor(bottom). It follows the button, and the engine decides when to flip or shift it.

Readout

Trace

    One line per change, in the order they happened. Each line is viewport | centred rect | anchored rect, in CSS px.