Loading...
[popover] {
display: block;
opacity: 0;
}
[popover].open {
opacity: 1;
}[popover] {
opacity: 0;
transition: opacity 0.2s, display 0.2s allow-discrete, overlay 0.2s allow-discrete;
}
[popover]:popover-open {
opacity: 1;
}
@starting-style {
[popover]:popover-open { opacity: 0; }
}:popover-open follows the real state, and @starting-style with 'allow-discrete' lets the popover fade in and out.
display: block on [popover], which keeps it visible when closed.popover attribute and :popover-open, not a class toggled by JavaScript.@starting-style, and display and overlay transition with 'allow-discrete'.@media (prefers-reduced-motion: reduce).:popover-open matches shown popovers. :open covers elements like <details>, <dialog> and <select> and doesn't match popovers.
Use [popover]::backdrop. It is rendered behind the popover while it is shown in the top layer and is transparent by default.