# Content on Hover or Focus: Tooltips Done Right

Source: https://allyway.ai/glossary/content-on-hover-or-focus

Content on hover or focus is WCAG success criterion 1.4.13. Where pointer hover or keyboard focus makes extra content appear – a custom tooltip, sub-menu or pop-up – it must be dismissible without moving the pointer or focus, hoverable, and persistent until the user is done.

Content on hover or focus means [tooltips](https://allyway.ai/glossary/accessible-tooltip), sub-menus and small pop-ups that appear when the mouse rests on an element or the keyboard focus reaches it. WCAG 1.4.13 does not forbid them, but sets three rules: people must be able to close them, move the pointer onto them, and read them for as long as they need. Without these rules, a tooltip can cover the very text someone is trying to read.

## What it means

[WCAG 1.4.13 Content on Hover or Focus](https://www.w3.org/WAI/WCAG22/Understanding/content-on-hover-or-focus.html) is a Level AA criterion in [WCAG 2.2](https://allyway.ai/regulations/wcag-2-2). Where receiving and then removing hover or focus triggers additional content, all three conditions apply:

| Condition | Requirement | Exception |
|---|---|---|
| Dismissible | It can be closed without moving the pointer or focus, e.g. with Escape | It shows an input error, or it covers no other content |
| Hoverable | If hover triggers it, the pointer can move onto it without it disappearing | – |
| Persistent | It stays visible until hover or focus moves away, the user closes it, or its information is no longer valid | – |

Browser tooltips from the HTML `title` attribute are exempt: their look is controlled by the browser, not the author. Custom tooltips, sub-menus and other non-modal pop-ups are covered. A [skip link](https://allyway.ai/glossary/skip-link) that appears on focus is not covered, because it adds no extra content.

Why it matters: screen magnifier users pan by moving the pointer or focus, so a tooltip that vanishes when the pointer moves is impossible to read at 400 % zoom. People with a large mouse pointer need to move onto the tooltip to see what the pointer hides. People with low vision or cognitive disabilities need time to notice new content.

> **Tip:** > **Escape is the simplest dismiss mechanism**
> Close the pop-up when Escape is pressed while hover or focus stays where it is. Make sure the trigger itself stays visible, so the [visible focus](https://allyway.ai/glossary/focus-visible) is never lost behind the tooltip.

## Examples

```html title="Example"
<button type="button" aria-describedby="tip-vat" class="has-tip">
  Price incl. VAT
</button>
<div role="tooltip" id="tip-vat" class="tip" hidden>
  VAT is calculated from your billing country.
</div>

<script>
  // Show on hover and focus, keep open while the pointer is over the tooltip,
  // close with Escape without moving the pointer or focus.
  document.addEventListener('keydown', (e) => {
    if (e.key === 'Escape') document.getElementById('tip-vat').hidden = true;
  });
</script>
```

The tooltip is linked with `aria-describedby`, so screen readers read it with the button. It touches the button with no gap, so the pointer can move from the trigger onto the tooltip without it closing.

**Do:** Do

Close tooltips and pop-ups with Escape, leave no gap between trigger and tooltip, keep content open while the pointer is over it, and work the same way with [keyboard navigation](https://allyway.ai/glossary/keyboard-navigation) and the mouse.

**Don't:** Don't

Hide the tooltip after a fixed timeout, close it as soon as the pointer leaves the trigger, show it on hover only, or let it cover the focused element.

## How to check content on hover or focus



## Questions

Q: What does dismissible, hoverable and persistent mean?
A: Dismissible: you can close it without moving pointer or focus. Hoverable: the pointer can move onto it without it vanishing. Persistent: it stays until you move away, close it, or its information is no longer valid.

Q: Does the title attribute fail WCAG 1.4.13?
A: No. Tooltips created by the `title` attribute are controlled by the browser and are named by W3C as the exception. They have other problems – they do not show on keyboard focus or touch – so do not rely on them for important information.

Q: Do tooltips need to close with the Escape key?
A: WCAG requires "a mechanism" to dismiss them without moving pointer or focus. Escape is the common, expected solution. Content that shows an input error or covers no other content does not need one.

Q: Are hover menus covered by 1.4.13?
A: Yes. W3C names sub-menus explicitly. A navigation menu that opens on hover must stay open while the pointer moves into it and must close with Escape if it covers other content.

Q: How can I test tooltips across many pages?
A: Check each tooltip and menu component once in your design system or template, then spot-check pages. The [free WCAG scanner](https://allyway.ai/free-wcag-accessibility-scanner-for-websites) finds related code issues, such as icon buttons without a name.
