On this page

Tooltip

Keys, what Tooltip gives you and what your team does.

Conformance

Tooltip meets WCAG 2.2 level AA when used as described on these pages. It follows the Tooltip pattern of the WAI-ARIA Authoring Practices and 1.4.13 Content on Hover or Focus.

Keyboard

Key Action
Tab Moves focus to the trigger and shows its tooltip.
Esc Hides the tooltip. Focus stays on the trigger.
Shift + Tab Moves focus away and hides the tooltip.

What Tooltip gives you

  • role="tooltip" on the text.
  • The text linked to its trigger: as the name (aria-labelledby, present while the tooltip is closed) or as a description (aria-describedby, while it is open).
  • Opens on keyboard focus as well as on hover.
  • Stays while the pointer moves onto it, hides on Esc, and stays until the pointer or focus leaves (WCAG 1.4.13).
  • Text contrast 14.1:1 in light and 15.4:1 in dark (text.inverse on surface.inverse).

What your team does

  • Put tooltips on interactive elements only: buttons, links, menu items.
  • Use relationship="label" for an icon-only button, and give it no aria-label.
  • Keep anything people need to finish a task on the page, not in a tooltip.
  • Put no links or buttons in a tooltip.
  • Don’t put a keyboard shortcut only in a tooltip; list shortcuts where everyone can find them.

WCAG criteria

Criterion Level How
1.1.1 Non-text Content A An icon-only trigger is named by its tooltip
1.4.3 Contrast (Minimum) AA 14.1:1 and 15.4:1
1.4.13 Content on Hover or Focus AA Can be hidden with Esc, can be hovered, stays until dismissed
2.1.1 Keyboard A Opens on focus
4.1.2 Name, Role, Value A role="tooltip", aria-labelledby or aria-describedby