Popover API Animations

1. Traditional JavaScript Method

Uses JS to manage classes and delay the closing of the popover to allow the exit animation to play. (Note: native light-dismiss will bypass the JS exit animation).

JS Animated Popover

I animate using JavaScript class toggling.

2. CSS Keyframes Method

Uses CSS @keyframes on the :popover-open selector. Great for entry animations, but cannot animate the exit state natively because display: none applies instantly on close.

Keyframe Popover

I animate in using CSS keyframes, but snap closed instantly.

3. @starting-style (Modern CSS)

The new web standard. Uses @starting-style and allow-discrete to seamlessly animate both entry and exit states completely in CSS, even supporting light-dismiss.

Modern CSS Popover

I animate smoothly in both directions with purely modern CSS.