Small interactions can make a webpage easier to use: opening a tip, changing a setting, or reusing an interface component.
What You Need to Know
Popover auto can support light dismissal, manual requires explicit control, and hint is intended for less persistent hints. Their behavior differs, so choose deliberately.
Try the Example
Take a look at the example. We’ll explain the important lines right below it.
<button type="button" popovertarget="auto-tip">Show auto tip</button>
<div id="auto-tip" popover="auto">An auto popover can light-dismiss.</div>
<button type="button" popovertarget="manual-tip">Show manual tip</button>
<div id="manual-tip" popover="manual">A manual popover needs deliberate dismissal.</div>
Let’s Read the Code
- popover: Popover lets supported browsers manage showing and hiding a small overlay.
- <button>: The button offers an action; its type or command determines what happens.
- type: Type changes what sort of control or resource the browser uses.
- popovertarget: Popovertarget connects a trigger button to a popover by ID.
What the example shows: Auto, manual, and hint are different popover states; their dismissal and interaction expectations differ.
What Happens in the Browser?
When this example includes JavaScript, it supplies behavior that ordinary HTML does not automatically provide. Always think about a fallback.
Start with native behavior. Details, dialog, and popover each solve a different interface problem. Choose the simplest control that actually matches what a visitor wants to do, then test focus and dismissal as well as appearance.
Your Turn
Open both and compare what clicking elsewhere does.
Common Beginner Mistakes
- Assuming new HTML syntax works in every browser without testing.
- A manual popover can stay open unless explicitly hidden; always offer a sensible way to close it.
Key Takeaways
- Popover auto can support light dismissal, manual requires explicit control, and hint is intended for less persistent hints.
- popover: Popover lets supported browsers manage showing and hiding a small overlay.
- Test the behavior you expect rather than trusting how the snippet looks in your editor.