popover is a global attribute: any element can have it. A popover is hidden until shown, then rendered in the top layer, above all z-index stacking and outside any overflow clipping. You show it without script from a button, <button popovertarget="menu">, with popovertargetaction="show", "hide" or the default "toggle"; or with showPopover(), hidePopover() and togglePopover(). :popover-open matches while it's shown, and beforetoggle and toggle events report oldState and newState.
Its value picks the behaviour:
auto(alsopopoverwith no value): light dismiss, meaning a click outside or Escape closes it. Opening one closes every other openautopopover that isn't its ancestor. A popover opened from inside another, or nested in its DOM, keeps the outer one open, so menus and submenus work.manual(and any invalid value): no light dismiss, no Escape, closes nothing else. Use it for toasts and anything you close yourself.hint: light dismiss likeauto, but opening it closes only other hints, notautopopovers. It's meant for tooltips. Chrome 151 and Firefox 153 support it; Safari doesn't yet.
How it differs from <dialog>:
- A popover is never modal. The page stays clickable and focus stays where it was; in tab order, the popover's contents come right after the button that opened it.
showModal()makes the page inert and moves focus inside. - A popover has no role of its own and no
returnValueormethod="dialog". It's behaviour you add to an element that keeps its own semantics. <dialog>has no light dismiss unless you setclosedby="any".
Pick showModal() for anything that must block the page until answered. Use popover for menus, pickers, tooltips and toasts. <dialog popover> gives a non-modal dialog with light dismiss; its open stays false, so check :popover-open.