Loading...
<div id="menu" popover>Menu</div>
<button onclick="document.getElementById('menu').showPopover()">Open</button><div id="menu" popover>Menu</div>
<button popovertarget="menu" popovertargetaction="show">Open</button>popovertarget opens the popover without script and exposes the expanded state to assistive tech.
showPopover() on an element without the popover attribute.popovertarget, not a click handler with showPopover().popover attribute and is in the document, otherwise the call throws.aria-expanded is kept in sync in the toggle event.Usually the element has no popover attribute or is not in the document. Check both before calling it.
Yes. An open popover renders in the top layer, above other content, regardless of z-index.
Use the :popover-open pseudo-class, and ::backdrop for the area behind it.