Skip to content

[@mantine/core] Tooltip: Rename interactive prop to hoverable and fix interactive-content guidance - #9110

Open
andrewborstein wants to merge 2 commits into
mantinedev:masterfrom
andrewborstein:fix/tooltip-hoverable-prop
Open

[@mantine/core] Tooltip: Rename interactive prop to hoverable and fix interactive-content guidance#9110
andrewborstein wants to merge 2 commits into
mantinedev:masterfrom
andrewborstein:fix/tooltip-hoverable-prop

Conversation

@andrewborstein

@andrewborstein andrewborstein commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #9072 / the interactive prop shipped in 9.5.1.

@rtivital I'm sorry if there was confusion or I could have been more clear in my original issue description, but the goal of #9072 was only to make the tooltip hoverable — so the pointer can travel from the target onto the tooltip without it closing (WCAG 2.1 SC 1.4.13, Hoverable). And at the very most, allow users to select/copy the contents of the tooltip, not to enable users to put interactive content in there. We obviously can't stop them but we shouldn't encourage them either.

1. The docs encourage putting interactive content in a tooltip

The updated docs say

Set interactive if the tooltip contains content that the user must be able to reach with a pointer, for example a link.

and the demo renders an <Anchor href> inside the tooltip.

However that wasn't the intent of the original fix because interactive/focusable content in a tooltip isn't accessible: a tooltip is exposed to assistive technology only as an aria-describedby description, isn't in the focus order, and is dismissed on Escape, so keyboard and screen-reader users can't reliably reach it.

Example guidance against interactive tooltip content:

This PR updates the docs to make that more clear, suggesting that interactive content be put in a Popover instead (an accessible non-modal dialog reachable by mouse, keyboard, and touch — which is what the WAI-ARIA APG recommends). It also updates the demo and also corrects a wording bug: 1.4.13 was described as applying only when the tooltip contains interactive content, but it applies to any content shown on hover (and a tooltip should never contain interactive content).

2. The prop name interactive contradicts that guidance

Naming the prop interactive is slightly misleading because it sounds like it's recommending the thing the accessibility guidance says not to do — the docs for interactive have to warn against interactive content, which feels odd. This PR renames the prop to hoverable, which names the actual behavior (and matches the WCAG 1.4.13 hoverable condition it satisfies). Default stays false for smallest impact on users, even though I think you could make a case it should default to true. Renaming the prop now, about a week after it shipped, keeps the breaking change as small as possible.

Commits (intentionally separable)

  1. Clarify that tooltips must not contain interactive content — docs/demo/JSDoc guidance fix. Non-breaking. Stands on its own.
  2. Rename interactive prop to hoverable — breaking rename on top, so it can be git reverted independently if you'd prefer to keep only the guidance fix, or take the guidance now and rename later.

The 9.5.0 changelog prose is left as the historical record of that release; only its live <Demo> reference was updated to the renamed export.

Happy to adjust the name, split differently, or drop the rename commit — whatever you prefer.

…active content

The docs, demo, and prop JSDoc added alongside the `interactive` prop (mantinedev#9072)
encouraged placing interactive content inside a tooltip — the docs used "for
example a link", and the demo rendered an `<Anchor href>` inside the tooltip.
Interactive/focusable content in a tooltip is inaccessible: the tooltip is
exposed to assistive technology only as an `aria-describedby` description, is
not in the focus order, and is dismissed on `Escape`, so its content cannot be
reliably reached by keyboard or screen reader users.

Reframe the `interactive` prop around what it is actually for: satisfying the
*hoverable* condition of WCAG 1.4.13 so the pointer can reach the tooltip body
without dismissing it (e.g. to read or select its content). The previous
wording also misstated WCAG 1.4.13 as applying only when the tooltip contains
interactive content; the criterion applies to any content shown on hover.

Interactive content must be reachable by keyboard and touch, not hover alone,
so it does not belong in any hover-triggered element (Tooltip or HoverCard) —
it should be a Popover, the accessible non-modal dialog.

- tooltip.mdx: rewrite the "Interactive tooltip" guidance and direct interactive
  content to Popover.
- Tooltip.demo.interactive: replace the link with non-interactive hoverable text.
- Tooltip.tsx: correct the `interactive` prop JSDoc.

Guidance references:
- WCAG 2.1 SC 1.4.13 Content on Hover or Focus:
  https://www.w3.org/WAI/WCAG21/Understanding/content-on-hover-or-focus.html
- WAI-ARIA APG Tooltip pattern ("A hover that contains focusable elements can
  be made using a non-modal dialog"):
  https://www.w3.org/WAI/ARIA/apg/patterns/tooltip
- Inclusive Components, Tooltips & Toggletips ("Don't put interactive content
  ... in tooltips or toggletips"):
  https://inclusive-components.design/tooltips-toggletips/
- Sarah Higley, "Tooltips in the time of WCAG 2.1" ("No interactive content"):
  https://sarahmhigley.com/writing/tooltips-in-wcag-21/
- CSS-Tricks, Tooltip best practices ("Tooltips must not contain interactive
  content"):
  https://css-tricks.com/tooltip-best-practices
BREAKING CHANGE: the `interactive` prop introduced in 9.5.1 is renamed to
`hoverable` (default still `false`).

The prop keeps the tooltip open while the pointer moves onto it — it satisfies
the *hoverable* condition of WCAG 1.4.13. It has nothing to do with the tooltip
containing interactive content; in fact interactive content must not go in a
tooltip (see the preceding guidance commit). The name `interactive` promised
the opposite of what the accessibility guidance recommends, so the docs for it
had to warn against interactive content — a permanent contradiction. Renaming
to `hoverable` names the actual behavior and removes that contradiction.

Renaming now, while adoption is minimal (shipped 8 days ago), keeps the
breaking change as cheap as it will ever be.

- Rename the prop, the `data-interactive` mod to `data-hoverable`, and the
  internal `interactiveMod` variable across Tooltip.tsx and use-tooltip.ts.
- Update tests, story, the demo (file/export renamed to `hoverable`), and the
  Tooltip docs page (section, prose, anchor, examples).
- Update the 9.5.0 changelog demo reference to the renamed export; its prose is
  left as the historical record of the 9.5.0 release.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant