Reference guide · html-css-js · Published 2026-08-16 · 3 min read

HTML Popover API guide

Learn the HTML Popover API to build menus, tooltips and panels with popover and popovertarget. See browser support and accessibility notes.

What the API does

The HTML Popover API gives browsers a native way to show overlay UI such as menus, tooltips and small panels. You mark an element with the popover attribute and open or close it from a trigger, and the browser handles the top-layer placement, focus and dismissal that used to require a library.

Because the popover renders in the browser's top layer, it sits above regular page content regardless of z-index, which removes the classic "this dropdown is hidden behind that section" battle. It also supports light dismiss: clicking outside the element or pressing Escape closes it without any script.

Popover markup

Mark an element as a popover and give a button a matching target:

<button popovertarget="menu">Open menu</button>

<div id="menu" popover>
  <p>This panel opens in the top layer and closes on click-outside or Escape.</p>
</div>

The popovertarget attribute ties the button to the popover's id. Add popovertargetaction="hide" or popovertargetaction="show" when a button should only open or only close rather than toggle. Programmatic control is still available through element.showPopover() and element.hidePopover() for cases that need script.

Support and a11y

The core Popover API is Baseline Widely Available, so Chrome, Edge, Firefox and Safari now ship it. This is a good place to state engine support precisely rather than wave at "all browsers": the base API works in Chrome and Edge 114 and later, Safari 17 and later, and Firefox 125 and later. Newer accents such as popover="hint" and auto-hide interest triggers are newer and roll out per engine, so feature-check before depending on them.

Accessibility is where to be careful:

A popover is a lighter-weight sibling of the dialog element; reach for dialog when a modal focus trap is required. Combine it with ARIA roles and semantic elements so the overlay stays usable, and handle any residual behaviour with event delegation rather than per-item handlers.

Need a website built, fixed, optimised, migrated or replaced?

This technical resource is written by CSMBAC, a small design and development studio. If you would rather hand the problem to a professional, the website service page explains how we build enquiry-ready websites.

Explore website services