v141 · css · pseudo-elements
The `::interest-button` pseudo element
Interest invokers let a link or button show a hovercard on hover, focus or long-press — but on a phone, long-pressing a link opens the browser’s context menu first. ::interest-button is an opt-in, fully styleable pseudo-element that sits right after an interest invoker; tapping it shows interest immediately, with no delay and no context menu. It only exists on valid interest sources, is deliberately not focusable, and never enters the accessibility tree.
HTMLInterestForInterestButtonPseudo is experimental. To run these demos for real: enable chrome://flags/#enable-experimental-web-platform-features and relaunch, or launch Chrome with --enable-blink-features=HTMLInterestForInterestButtonPseudo (or --enable-experimental-web-platform-features). There is no dedicated chrome://flags entry. Every page probes the generated box’s geometry — not CSS.supports(), which already returns true without the flag.
concepts
-
The ⓘ opt-in
The spec’s own example, live: a link and a button with interest targets, a
contentswitch (none,"ⓘ" / "", a text label) and a gate switch (always, or only under@media (any-pointer: coarse)). Watch the box appear, then tap it and see interest shown at once. -
Originating-element inspector
An inspection table of nine candidate hosts — enabled and disabled buttons, links with and without
href, adiv,input type=button, a danglinginterestforid — showing computedcontentversus the box that is actually generated. Includes the detection gotcha (CSS.supportslies) and the::after→::interest-buttonordering. -
Touch link hovercards
The product use case: an article whose people and project links carry hovercards. On touchscreens a ⓘ appears after each link — tap it to preview, tap the link text to navigate. A readout proves the ⓘ tap did not follow the link; an honestly-labelled toggletip fallback covers browsers without the pseudo.
-
Activation event order
The edges: what events the originating element receives when its ⓘ is pressed, how
preventDefault()on the click or oninterestcancels it, whyinterest-delay: 1000sdoesn’t slow it down, why Tab skips it, and how removinginterestforremoves the box. -
Anchored to the glyph
Composition: product cards with the ⓘ absolutely positioned in each card’s corner, a
popover=hintplaced withposition-area, and:interest-sourcestyling. A geometry readout measures whether the card anchored to the invoker or to the ⓘ — the spec says the ⓘ.
why it shipped
Showing interest on touchscreens is cumbersome: long-pressing a link brings up the native context menu, and the user has to find a “Show details” item in it. Developers asked for a one-tap path but also said an extra button isn’t always appropriate (constrained layouts, truly secondary information), so the button is opt-in: it renders only when you give ::interest-button a content value. Because all the information it conveys is already on the originating element, it stays out of the focus order and the accessibility tree.
the API
<a href="/users/mfreed7" interestfor="profile">@mfreed7</a>
<div id="profile" popover="hint">Profile hovercard</div>
<style>
@media (any-pointer: coarse) {
a[interestfor]::interest-button {
content: "ⓘ" / ""; /* opt in; empty alt text */
}
}
</style>
references
- ChromeStatus entry (chromestatus.com/feature/5070829070188544)
- Spec — CSS Pseudo 4 §4.4 Interest Indicators
- Open UI interest invokers explainer (touchscreen affordance)
- CSSWG issue #12437 — initial proposal
- WPT: interestfor-pseudo tests
- Sample (jsbin)
- crbug.com/453705247 — implementation tracking
- TAG review #1058
- Interest invokers (
interestfor) demos