The popover attribute gives an element browser-managed show and hide behavior; a button can target it by ID.
HTML popover: show dismissible nonmodal help with a button
Use it for a real task
A reviewer needs a short explanation of a hold code without leaving the form. The help panel is nonmodal, so the rest of the page remains available. Auto popovers can be dismissed by clicking elsewhere or making a close request. The trigger is placed next to the panel in source order, which makes their relationship easier to follow when the interface changes.
<button type="button" popovertarget="hold-help">What does hold mean?</button>
<section id="hold-help" popover="auto" aria-labelledby="hold-help-heading">
<h2 id="hold-help-heading">Hold a receipt</h2>
<p>A held receipt stays out of export until a reviewer resolves it.</p>
</section>What the markup guarantees
A popover does not block background interaction or impose the focus behavior of a modal dialog. Test browser support and keyboard operation for your audience, and retain the meaning in ordinary page text when help is essential to completion.
Cost and limits
Native toggling avoids a custom click-away handler. The panel still adds DOM and may need positioning CSS; long or destructive workflows belong in a different interface.
Common Mistakes
- Do not use a popover as a modal confirmation.
- Do not point popovertarget at a missing ID.
- Do not hide indispensable instructions only inside optional help.
Connected lessons
- HTML dialog versus popover: decide whether the task blocks the page
- HTML details and dialog: distinguish disclosure from a modal task
- HTML focus order: use native controls and keep DOM order usable
Continue with HTML manual popover: keep a nonmodal panel open until a deliberate close.
