Tooltips:
an investigation in four parts

Part 1: What is a tooltip?

Many examples of tooltips in the wild, including icon names, simple descriptions, and hover cards

When we say "tooltip," we're speaking a visual language:

  • It appears on mouse hover
  • It overlays other content
  • It is in close proximity to whatever triggered it

There are commonalities in interaction:

  • Appears and disappears on hover
  • Interaction is optional and non-blocking

These are not commonalities in purpose

In contrast, let's consider these other patterns:

Table:

A structured presentation of data with two-dimensional relationships.

A basic styled table with sample data on houses for sale

Tabs:

A group of related panels, of which only one is exposed at any given time.

VS Code file tab UI

Toolbar:

A set of related actions, often for modifying the same visually associated region.

A simple rich text editor toolbar, taken from the Aria Practices Guide

Tree:

A list of hierarchical pieces of content or actionable items

simple file viewer tree view, taken from the APG

Take 2, tooltips:

Extra, non-essential helper text?

No...

Alternative text?

No...

Tooltips are a visual pattern, not a functional pattern

Part 2: Tooltip Semantics

What is the tooltip role?

Let's get this out of the way...

If tooltips aren't a functional pattern, why do they have a role?

A contextual popup that displays a description for an element (...) Authors SHOULD ensure that elements with the role tooltip are referenced through the use of aria-describedby

Name vs. description

two tooltips, one showing the name of a text align icon, and the other showing username requirements for a username form field

On the control the tooltip is naming/describing, regardless of where the trigger is:

Name: aria-labelledby

Description: aria-describedby

Do not duplicate the name and description

Add tab button with add tab tooltip

Errormessages

Form field with two tooltips: one for description, and one error message
aria-describedby="description-id error-id"

OR

aria-describedby="description-id" aria-errormessage="error-id"

Hovercards: no internal semantics will be conveyed

Twitter profile hover card for the Microsoft account

Tooltip content is never independent of the control it describes

username field with instructions in a tooltip username field with instructions in text below the field

Part 3: Interaction

icons for mouse, tab, touch, speech, eye control, and switch

Browsers and tooltips: a history

The title attribute will turn 27 this year

party for tooltips!

No modern browser supports showing the `title` attribute on focus

line drawing of a lone person looking sadly at a cake

Beyond Browsers: Custom tooltip inaccessibility


.tooltip:hover,
.tooltip:focus {
	display: block;
}
					

Where this works:

  • Desktop with mouse
  • Desktop with keyboard
  • Form inputs anywhere

Where this doesn't work:

  • Touchscreens on links or buttons
  • Eye control and other pointers on links or buttons
  • ZoomText and magnifiers, where the pointer must be able to move over the tooltip

Zooming, dismissing, and WCAG 2.1

Content on Hover or Focus

Where receiving and then removing pointer hover or keyboard focus triggers additional content to become visible and then hidden, the following are true:

Dismissable: A mechanism is available to dismiss the additional content without moving pointer hover or keyboard focus, unless the additional content communicates an input error or does not obscure or replace other content;
Hoverable: If pointer hover can trigger the additional content, then the pointer can be moved over the additional content without the additional content disappearing;
Persistent: The additional content remains visible until the hover or focus trigger is removed, the user dismisses it, or its information is no longer valid.

Let's break down hoverable and persistent:

Now Dismissable for keyboard:

the escape key

And finally, Dismissable for pointer users:

the escape key, question mark?

Where this doesn't work:

  • Modals
  • iFrames
  • Comboboxes
  • Touch & pointer

If escape doesn't work, what does?

Usability testing tooltips

two tooltips, without a close button and with a close button in the corner and one tooltip with a close button near the trigger

Tooltips in forms: maybe don't?

four styles of tips on a form: tooltip, two toggle tips, and static text

User feedback:

  • iOS keyboard overlap
  • Not reviewable
  • Hard to show/hide
  • It "looked a bit annoying"

Recommendation: static text or toggle tips

two examples of a toggle tip opened next to a form field label and static text above a form field, both with green check marks

Dismissing tooltips

an escape key, a control key, and a close icon
three tooltips, one with a close button in the corner, one with a close button above, and one with no close button

Feedback:

  • Close buttons = good
  • Position is important
  • Control > Escape
  • Still not reviewable

Main takeaway: when given a close button, people use the close button.

My tooltip hot take:

WCAG 1.4.13's dismissable bullet is both prohitively difficult to implement in practice, and not ideal for magnification users. Don't follow it. Do better.

Do this instead:

tooltip next to an icon button with a close button above the tooltip next to the icon

Hover Cards

hover card showing my github profile information next to my github avatar
very long hover card of virtual machine information, including headings, buttons, and links

As a tooltip, this will:

  • Be read all at once by screen readers
  • Be inaccessible through keyboard
  • Be a pain for magnification users
  • Be a pain for everyone else, too
A button that shows a non-modal dialog containing text about how to use a tooltip and a list of links.

As a toggletip, this will:

  • Retain semantics
  • Give show/hide control to everyone
  • Be more discoverable

Part 4: Writing Tooltip Content

The Tooltip Content Paradox:

You must assume that some people will never be able to access the tooltip, so its content must not be necessary to use the UI.

But if the tooltip is unnecessary, why have it at all?

The SAGA of alt text

Or: what happens when content is written exclusively for abled people

Two fairies drawn in a realistic comic book style, one holding a child

It begins in the dark days of yore, web browsers decided to present image alt text as a visual tooltip.

netscape and internet explorer 5 saying remember us?

So people began writing alt text aimed at sighted users:

  • This image is mapped, please download it
  • Self explanatory
  • Turn on image loading, damnit!
  • (Sorry, Not Available With Your Web Client)

All from A. J. Flavell, circa 2006

Then the title attribute was introduced to images in HTML4, bringing about the image tooltips we have now.

XKCD comic that says 'how do you annoy a web developer?' with incorrect HTML, and title text that says 'like this' with mismatched tag cases
Source: XKCD

This, of course, solved all remaining tooltip accessibility problems.

The HTML spec explicitly warns against the title attribute, saying user agents have not implemented it accessibly

So, when you write your tooltips:

  • Keep it short (it is often not easily reviewable)
  • Keep in mind the purpose: naming or describing
  • Keep it non-essential

What now?

We spend so long trying to make existing visual patterns accessible, when we should be trying to address the original need in a way that works for everyone.

Next time you struggle over tooltip accessibility, ask:

Why am I adding this text to the UI? Where else could it go?

Consider toggletips for longer or structured content:

a toggle tip with structured content, headings, and links, below a button with an info icon

Consider static text for shorter strings:

form field with static text description and menu button with both an icon and the word menu

Or be creative! Make something new, and make it work for everyone.