Hover Tooltips With Zero JavaScript: the html interestfor Attribute
October 11, 2026 | 9 min read | CSS
By Syed · Frontend Engineer & Creator of UITweak
Every hover tooltip you have ever shipped came with a tax: mouseenter and mouseleave listeners, a focus handler for keyboard users, timers so the tooltip does not flicker, and cleanup code so the timers do not leak. The html interestfor attribute deletes that tax. It is part of the interest invokers proposal, and it lets you declare the relationship between a trigger and a tooltip in plain HTML. The browser watches hover, focus, and long-press for you, then shows and hides the popover itself. No listeners, no timers, no framework code.
This is an early feature, so this guide is honest about where it runs and where it does not. You get the full recipe for Chromium browsers today, a real fallback story for Firefox and Safari, and the anchor-positioning pairing that finishes the zero-JavaScript tooltip. Write it once and it gets better automatically as browsers adopt it.
30-second version: put interestfor="tip-id" on a button or link, give the tooltip id="tip-id" plus popover="hint", and the browser shows the tooltip on hover, focus, or long-press and hides it when interest ends. Tune timing with interest-delay-start / interest-delay-end, position with position-area (the invoker is an implicit anchor), and ship a :hover CSS fallback for Firefox and Safari.
What the html interestfor Attribute Actually Does
An interest invoker has two parts. The invoker is the element the user interacts with. The target is the element that reacts when the user shows interest in the invoker. You connect them with the interestfor attribute on the invoker, whose value is the id of the target. "Showing interest" means hovering, focusing, or long-pressing the element, and "losing interest" means the user stopped. Pressing Escape cancels interest everywhere, which is a built-in escape hatch for distracting interactions.
When the target has the popover attribute, the browser shows and hides it for you automatically. That is the whole tooltip behavior, declarative. The target also receives interest and loseinterest events if you ever want to run custom code, but for tooltips you will not need them.
Two restrictions worth memorizing. First, the invoker is limited to interactive elements: HTML <a>, <button>, <area>, or SVG <a>. Putting interestfor on a div or span does nothing. Second, the target can be almost any element type, but it only becomes a tooltip automatically when it is a popover.
The html interestfor Recipe: Tooltip With Zero JavaScript
Here is the complete recipe. The trigger carries interestfor, the tooltip is a popover="hint" with a matching id:
<button interestfor="tip-shipping">Shipping info</button>
<p id="tip-shipping" popover="hint">
Orders ship within 24 hours, Monday to Friday.
</p>That is it. No script tag. Hover the button and the tooltip appears. Move away and it disappears. Tab to the button and keyboard users get the same tooltip, which is the part most hand-rolled JS tooltips forget.
Use popover="hint", not plain popover, for tooltips. Plain popovers are auto popovers: only one can be visible at a time, so a tooltip would force-close a dropdown the user already opened. hint popovers are allowed to coexist with auto popovers, which is exactly what tooltips should do. This is the same popover API family covered in our custom select popover guide, just wearing a different attribute.
Pair It With Anchor Positioning
The browser-default popover position (centered via the user-agent stylesheet) is useless for a tooltip. You want it attached to the trigger. Anchor positioning solves this, and interest invokers make it free: linking a popover to its invoker with interestfor creates an implicit anchor reference, so you never declare anchor-name or anchor-default. Just pick a position:
<button interestfor="tip-price">What is this?</button>
<p id="tip-price" popover="hint" class="tip">
Price includes VAT. Discounts apply at checkout.
</p>.tip {
/* the invoker is the implicit anchor: no anchor-name needed */
position-area: bottom;
margin: 8px 0 0 0;
max-width: 260px;
background: #111827;
color: #f9fafb;
padding: 10px 14px;
border-radius: 10px;
font-size: 13px;
}position-area: bottom pins the tooltip below its trigger automatically, wherever the trigger sits on the page. Anchor positioning reached Baseline across browsers in September 2026, so this half of the recipe is safe everywhere the first half runs.
One more free benefit: because the tooltip is a popover, it renders in the top layer, above stacking contexts, transformed parents, and overflow: hidden ancestors that clip every hand-rolled tooltip. If stacking contexts have bitten you before, our top layer and z-index escape guide explains exactly why this works.
Tune the Timing With interest-delay
A tooltip that appears the instant the cursor grazes a button is annoying. The CSS interest-delay shorthand (plus the interest-delay-start and interest-delay-end longhands) controls the gap between showing interest and the browser acting on it. Set them on the invoker:
[interestfor] {
interest-delay-start: 250ms; /* wait before showing */
interest-delay-end: 100ms; /* wait before hiding */
}Then borrow the nicest pattern from the spec examples: once the user has shown interest in one trigger inside a group, drop the start delay to zero so they can sweep across neighboring triggers without waiting each time. The :interest-source pseudo-class matches the invoker while interest is shown:
.toolbar:has([interestfor]:interest-source) [interestfor] {
interest-delay-start: 0s;
}
/* highlight the trigger while its tooltip is visible */
[interestfor]:interest-source {
outline: 2px solid #6366f1;
}
/* style the tooltip while interest is shown */
.tip:interest-target {
border: 1px solid #6366f1;
}:interest-target matches the tooltip itself while interest is shown, and :interest-source matches the trigger. They are the interest-invoker equivalents of :hover, but they follow the browser's real interest state instead of just the pointer.
Honest Browser Support: Where interestfor Runs Today
Interest invokers are an early feature. The OpenUI community group wrote the explainer, and the delay properties live in the CSS UI Level 4 draft. Chromium shipped ahead of the final spec text, which is common for OpenUI proposals but means the details can still evolve. Here is the verified support picture as of October 2026:
- Chrome 142+ and Edge 142+ (October 2025): supported, including Chrome for Android.
- Firefox: not supported. Mozilla is tracking implementation in bug 1984699, with no shipped version yet.
- Safari: not supported, on macOS or iOS. WebKit has the standards position filed and no shipped version yet.
Treat it like any progressive enhancement: a delightful upgrade where supported, invisible where it is not. The next section gives you the fallback that makes this safe to ship today.
The Fallback: Feature Detection Plus a CSS-Only Tooltip
Never rely on interestfor alone while two engines lack it. The recommended feature check looks for the interestForElement DOM property on a button, and if it is missing, you add a class to the document element:
const supported = Object.hasOwn(
HTMLButtonElement.prototype,
"interestForElement"
);
if (!supported) {
document.documentElement.classList.add("no-interest-invokers");
}Then pair every popover tooltip with a plain CSS-only tooltip sibling that only activates under that class. The popover stays the source of truth for content; the fallback duplicates it for the unsupported case:
<span class="tip-wrap">
<button interestfor="tip-1">Hover me</button>
<span id="tip-1" popover="hint" class="tip-pop">
Ships in 24 hours.
</span>
<span class="tip-css" aria-hidden="true">
Ships in 24 hours.
</span>
</span>.tip-wrap { position: relative; }
.tip-css {
display: none;
position: absolute;
bottom: calc(100% + 8px);
left: 50%;
transform: translateX(-50%);
background: #111827;
color: #f9fafb;
padding: 10px 14px;
border-radius: 10px;
font-size: 13px;
white-space: nowrap;
}
/* unsupported browsers: classic hover tooltip */
.no-interest-invokers .tip-wrap:hover .tip-css,
.no-interest-invokers .tip-wrap:focus-within .tip-css {
display: block;
}In Chromium the popover path runs and the .tip-css sibling stays hidden. In Firefox and Safari the class flips on and the classic :hover / :focus-within tooltip takes over. Yes, the text is duplicated in the markup. For tooltips, which are short strings, that is a fair trade for zero JavaScript and full coverage. If you would rather not duplicate, the spec author's interestfor polyfill is a single-script alternative that emulates the native behavior in unsupported browsers.
Gotchas Before You Ship
- Clicks still do their normal thing. Showing interest never activates the invoker. A link with
interestforstill navigates on click, and a button still submits. You can combineinterestfor(hover tooltip) with a click popover on the same button, usingpopover="hint"for the tooltip so both can be visible at once. - Only a, button, area, and SVG a can be invokers. Wrapping a card in a div and pointing
interestforat the div will silently do nothing. Use a button styled as the card surface. - Long-press on touch devices shows interest, but touch behavior is the least specified part of the proposal. Test on a real device before relying on it for mobile-only UI.
- Keep tooltips non-interactive. Interest is lost when the pointer leaves the invoker, so links and buttons inside a hover tooltip are unreachable. Put quick actions in a click-triggered
autopopover instead. - Escape cancels everything. Do not fight it: it is the accessibility escape hatch, and overriding it breaks user expectations.
Decision Tree + Recap
- Tooltip needed? Put
interestfor="id"on the button or link, andidpluspopover="hint"on the tooltip. Zero JavaScript, hover, focus, and long-press all covered. - Position it with
position-area. The invoker is an implicit anchor, so noanchor-namesetup is required. - Tune timing with
interest-delay-startandinterest-delay-endon the invoker. Drop the start delay to zero inside a group once interest is already shown. - Style the live states with
:interest-source(trigger) and:interest-target(tooltip). - Support check: Chrome 142+ and Edge 142+ only, as of October 2026. Firefox and Safari do not support it yet.
- Ship the fallback: detect
interestForElement, addno-interest-invokers, and show a CSS:hover/:focus-withintooltip in unsupported browsers. - Keep tooltip content short and non-interactive. Interactive content belongs in a click popover.
Related: tooltips are popovers, and popovers live in the top layer. Our top layer and z-index escape guide explains the stacking model that makes your interestfor tooltips float above every ancestor, and the custom select popover guide covers the popover API this recipe is built on.
Frequently Asked Questions
Is interestfor part of the HTML spec yet?
Not finalized. It is an OpenUI proposal, and the delay properties (interest-delay-start, interest-delay-end) live in the CSS UI Level 4 draft. Chromium shipped it in version 142 (October 2025) ahead of final spec text. Expect small behavior changes as the spec matures.
Does interestfor replace the title attribute?
For styled tooltips, yes, and it is a strict upgrade: title tooltips are slow, unstyled, keyboard-inaccessible in most browsers, and impossible to position. Keep title only as a last-resort fallback, or drop it entirely and ship the CSS fallback recipe above.
Can I use interestfor for click popovers too?
No, interest invokers only respond to interest (hover, focus, long-press), not activation. For click behavior use popovertarget or command invokers on the same element. The two can coexist:interestfor for the hover tooltip, a command for the click panel, with popover="hint" on the tooltip so they can both be visible.
Will interestfor work in all browsers soon?
No public ship dates exist. Mozilla tracks implementation in bug 1984699 and WebKit has a standards position filed, but as of October 2026 neither has shipped. Ship with the CSS fallback and you do not need to wait: supported browsers get the native path and everything else gets the hover tooltip.