Loading...
<button onclick="menu.style.display = 'block'">Menu</button>
<div id="menu" style="display: none">...</div><button popovertarget="menu">Menu</button>
<div id="menu" popover>...</div>The browser shows the popover in the top layer and closes it on outside click or Esc.
display: flex on the popover selector, so it stays visible when closed.popover='manual' and then wondering why outside clicks and Esc do not close it.<button> with popovertarget, not by toggling a class or display in JS.z-index hack: a popover is shown in the top layer.:popover-open, not on the base selector.<dialog>, not a popover.'auto' closes on outside click, Esc and when another auto popover opens. 'manual' stays open until you close it.
No. A popover is non-modal and the page stays usable. Use a modal <dialog> when the user must respond first.
Style :popover-open for the open state and use @starting-style with transitions on display and overlay.