The Popover API, Done Properly
A native HTML feature for showing content on top of the page, such as menus, tooltips and pickers, using the popover attribute instead of custom scripts.
On this page
What is at stake
It provides top-layer display, light dismiss and keyboard behavior built into the browser, reducing custom code and bugs.
The playbook
- Use popover for menus and non-modal overlays
- Use dialog for modal interactions
- Give popovers accessible names where needed
- Test keyboard behavior
- Provide fallbacks if older browsers matter
Where it goes wrong
Avoid:
- Custom z-index hacks for overlays
- Using popover for modal dialogs
- Popovers without keyboard access
- Nested popovers with confusing dismissal
The numbers behind it
| Measure | Figure |
|---|---|
| Attribute | popover on the element, and popovertarget on the controlling button |
| Top layer | popovers display above other content without z-index battles |
| Light dismiss | clicking outside or pressing Escape closes auto popovers |
| Browser support | all major browsers since 2024 |
Getting outside help
When to hand it over: Bring in help when replacing custom dropdown and tooltip libraries.
Where this comes from
- MDN Web Docs — Popover API
- web.dev — Baseline
The figures and practices above come from the sources listed.
Working on something like this?
We take on Web Design & Development work for teams who want it done once, properly. Tell us what you are building and we will tell you honestly whether we are the right studio for it. Start a project.
Where to go next
Spotted something wrong? Report an error on this page. We correct on the page and say what changed.