Course contentsShow
← Web Development
Lesson 1204 of 2,98221. Accessible ComponentsFree lesson

Tooltip Pattern

Build accessible tooltips that work with keyboard, mouse, and screen readers without breaking focus.

Tooltip Pattern

You'll learn how to create accessible tooltips that enhance information without trapping focus or confusing assistive technology users.

What Is an Accessible Tooltip?

A tooltip is a small popup that reveals supplementary information when you hover over or focus on an element. Unlike modals, tooltips should never trap focus or require interaction to dismiss. Think of them like sticky notes that appear when you need them and disappear just as easily—they're informational, not interactive.

The Core Challenge

Traditional tooltips often break for keyboard users and screen reader users. They might:

  • Only appear on mouse hover (keyboard users miss them)
  • Disappear when you try to read them with a screen reader
  • Not be announced at all
  • Contain interactive content (which shouldn't happen in a true tooltip)

Building It Right

The accessible pattern requires:

  1. Trigger on both hover AND focus so keyboard users see tooltips too
  2. Use role="tooltip" on the popup element
  3. Connect with aria-describedby on the trigger element (not aria-labelledby—tooltips supplement, they don't replace labels)
  4. Dismissible with Escape key for keyboard users
  5. Brief, non-interactive content only—if users need to interact, use a popover or dialog instead

Tooltips work best for short hints like "Click to copy" on a button or defining an unfamiliar term. Screen readers typically announce the tooltip content when focus lands on the trigger element.

Key Takeaway: Accessible tooltips appear on both hover and focus, use role="tooltip" and aria-describedby, contain only static text, and dismiss easily without breaking the user's workflow.