Tooltip

How the Tooltip works with a keyboard and assistive tech, and where it stands against WCAG 2.2 AA.

FreeReact and Vue
AAWCAG 2.2 target
4/4contrast pairs passing
3keyboard interactions

A tooltip is a short description that appears when its trigger is hovered or focused. It follows the WAI-ARIA tooltip pattern: role="tooltip" on the bubble, aria-describedby on the trigger, opened by keyboard focus as well as the pointer, and closed with Escape. The trigger keeps focus throughout.

Keyboard#

Tab

Focusing the trigger shows the tooltip at once, without the hover delay.

Shift+Tab

Moving focus away hides it.

Esc

Hides the tooltip. Focus stays on the trigger.

Semantics#

role="tooltip"

Marks the bubble as a description of another element.

Always
aria-describedby

Set on the trigger only while the tooltip shows, pointing at the bubble's id.

While open
aria-label

A tooltip describes; it does not name. An icon-only trigger still needs its own aria-label, with the same words.

Icon-only trigger
aria-hidden

The tail and the globe icon are decorative.

Tail and icon
<button aria-label>

The Large card's close button. It cannot be reached by keyboard inside a tooltip, so do not rely on it: see the checklist.

dismissible

Colour 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.

4.5:1

Label and description · Light, Dark

12 to 16px text against the bubble. Light puts #2a2a2a and #6d6d6d on white; Dark puts white and 70% #cbcbcb on #070707.

WCAG 1.4.3 Contrast (Minimum) ↗
3:1 if needed

Icon · Large

The Large card's icon is #8f8f8f on white (3.23:1) and #6d6d6d on dark (3.89:1). It is decorative, so it only needs 3:1 if it carries meaning.

WCAG 1.4.11 Non-text Contrast ↗
Not required

Bubble edge · Light

The #f2f2f2 stroke measures 1.12:1 on a white page. The text, not the edge, is the content.

WCAG 1.4.11 Non-text Contrast ↗
Dismissible, hoverable, persistent

Hover and focus content · Every tooltip

Escape hides it without moving the pointer or focus; the pointer can move onto the bubble, with a 120ms grace, without it closing; and it stays until the trigger loses hover or focus.

WCAG 1.4.13 Content on Hover or Focus ↗

Measured contrast#

Label (or Large title) and description text against the bubble, in both themes. All 4 pairs reach their minimum.

ThemeLabelDescription
Light · Bubble14.35passes5.17passes
Dark · Bubble20.14passes6.31passes

Motion#

  • On hover the tooltip waits 150ms, so it does not flash as the pointer passes. On keyboard focus it shows at once.
  • It fades in over 140ms only when motion is allowed; under prefers-reduced-motion it appears without the fade.

Checklist#

Never put the only copy of something people need in a tooltip. Touch screens only see it on focus, not on tap.

The trigger is one focusable element, such as a button. A tooltip on a <span> or a disabled button cannot be reached by keyboard.

Keep the text to a short phrase. Anything with links, buttons or more than a sentence belongs in a Popover.

The Large card's close button is not keyboard reachable: tabbing to it blurs the trigger and closes the tooltip. Use a Popover when people need to dismiss something.

The bubble flips or shifts to stay in the window, so it is never clipped at a screen edge.