Popover
How the Popover works with a keyboard and assistive tech, and where it stands against WCAG 2.2 AA.
The Popover is a non-modal dialog anchored to a trigger. The trigger says whether it is open and which panel it controls; opening it moves focus into the card, Escape returns focus to the trigger, and the page around it stays usable. It is opened by a click, never by hover.
Keyboard#
On the trigger, opens the popover and moves focus into the card. Pressed again, closes it.
On the trigger, the same as Enter. On Back, Next or Close, activates the button.
Moves through Close, Back and Next. Past the last one, focus moves on to the page and the popover stays open.
Moves back through the card's controls, then to the trigger.
Closes the popover and returns focus to the trigger.
Semantics#
aria-haspopup="dialog"Announces that the trigger opens a dialog.
Triggeraria-expandedtrue while the card is open, false when it is closed.
Triggeraria-controlsPoints at the card's id.
Trigger, while openrole="dialog"A non-modal dialog, named by ariaLabel (Tip by default) and described by the step copy.
Cardaria-live="polite"Back and Next change the copy in place, and the new tip is announced.
Step copy<button aria-label="Close">The close button has a name; the cross is hidden.
dismissIcondisabledBack cannot be pressed on step one and leaves the tab order.
Back on the first stepColour contrast#
Every variant and state has to meet WCAG 2.2 Level AA. Measure the colours as they land on screen: a translucent hover or press wash over whatever sits behind it.
Copy and step count · Always
The 14px tip is #6d6d6d on white (5.17:1); the step count is #2a2a2a (14.35:1).
WCAG 1.4.3 Contrast (Minimum) ↗Buttons · Rest, Hover
12px Back and Next labels against their fills, and the trigger's white label on #2a2a2a.
WCAG 1.4.3 Contrast (Minimum) ↗Card edge and tail · Always
The #f2f2f2 hairline and the tail are decoration. The tail points at the trigger, but the trigger's aria-controls is what ties them together.
WCAG 1.4.11 Non-text Contrast ↗Focus indicator · Focus visible
Every control, and the card itself when focus lands on it, rings in #1a6ef8 off a 2px white gap (4.54:1).
WCAG 1.4.11 Non-text Contrast ↗WCAG 2.4.13 Focus Appearance ↗Placement · Open
The card shifts or flips to stay inside its container, so it never covers the trigger or runs off the screen.
WCAG 2.4.11 Focus Not Obscured ↗Measured contrast#
Button labels and the close glyph against their fills, at rest and on hover, on the card's white surface. All 8 pairs reach their minimum.
Motion#
- The card scales from 97% and fades in over 140ms only when motion is allowed; under prefers-reduced-motion it appears at once.
- Back and Next swap the copy without animation.
Checklist#
Name the card after what it is (Getting started tour), not the default Tip.
Pressing Back on step two disables Back while it has focus, and focus is lost. Move focus to Next when that happens, before the code library ships.
A click outside closes the card without moving focus. Tabbing away leaves it open; that is expected of a non-modal dialog, but close it if it would cover what comes next.
Popovers open on click only. For a hover hint, use a Tooltip.
Buttons are 40px and the close button 28px, all over the 24px target minimum.
The step count (1 of 4) is not in the live region; include it in the copy if people need to hear where they are.
