Hub: index · watch · videos

Popovers (non-modal) — note

A popover is a small, temporary panel anchored to a trigger. Many popovers fail because they are hover-only, unnamed, or impossible to close.

Live demo: Open the popovers micro-demo

What goes wrong

Small, reliable pattern

If your popover behaves like a modal, consider using a real modal dialog instead. If it’s just helper text, consider inline helper text (no popover).

Checklist

Minimal snippet (concept)

<button type="button"
  aria-haspopup="dialog"
  aria-expanded="false"
  aria-controls="pop"
>Why?</button>

<div id="pop"
  role="dialog"
  aria-modal="false"
  aria-labelledby="popTitle"
  hidden
  tabindex="-1"
>
  <h3 id="popTitle">Why we ask</h3>
  <button type="button">Close</button>
</div>

// JS: toggle [hidden], update aria-expanded,
// focus() popover on open, close on Esc/outside click,
// restore focus to trigger.

Note: role="dialog" is reasonable for a popover that contains interactive controls. Don’t use menu roles unless it’s truly a menu.