HTML Popover: Native Nonmodal Overlays
Toggle a popover
A popover is content that appears above ordinary page content without making the page modal. Put popover on an element and popovertarget on a button with the matching ID. With the default auto state, the button toggles it and outside interaction or Escape can dismiss it.
<button type="button" popovertarget="tips">Tips</button><div id="tips" popover>Use short headings.</div>Activate Tips to show the content; activate it again to hide it.
Choose a manual popover
Use popover="manual" when dismissal should be explicit. Set popovertargetaction to show or hide on separate buttons. Manual popovers do not automatically light-dismiss on outside clicks or Escape. Provide a clearly labeled way to close them.
<button type="button" popovertarget="status" popovertargetaction="show">Show note</button><div id="status" popover="manual"> Draft saved. <button type="button" popovertarget="status" popovertargetaction="hide">Dismiss</button></div>Show note opens it; Dismiss hides it.
Keep ordinary page controls usable
Popover does not automatically supply the semantics of a menu, tooltip, or dialog. A simple help panel can contain ordinary links or text. Unlike a modal, showing a popover does not make the background inert. The hint state is a newer option for transient UI; verify support before adopting it.
<button type="button" popovertarget="help">Help</button><button type="button" id="other">Other action</button><div id="help" popover>Use Tab to move between controls.</div>Open Help, then focus Other action. It remains focusable.
Common mistakes and practice
Do not make critical instructions available only through an unsupported popover. In older browsers a plain div may remain visible, and its native invoker may not work. Keep the content useful in that state or provide a tested fallback.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
HTML Popover: Native Nonmodal Overlays — Knowledge Check
Apply the interaction concepts taught in this lesson.
What does popovertarget contain?
Which default popover state supports light dismissal?
Which action explicitly hides a popover?
Does popover make the background inert?
Does popover automatically create menu semantics?