v141 · css · pseudo-elements

Touch link hovercards

The case the pseudo-element exists for. Every person and project link in this article has a hovercard. With a mouse you hover; with a keyboard you focus. On a phone, long-pressing a link opens the browser’s context menu — so under @media (any-pointer: coarse) each link grows a ⓘ. Tap the ⓘ to preview; tap the link text to navigate. The readout proves which one happened.

Flag: Blink feature HTMLInterestForInterestButtonPseudo (status experimental). Enable chrome://flags/#enable-experimental-web-platform-features and relaunch, or start Chrome with --enable-blink-features=HTMLInterestForInterestButtonPseudo or --enable-experimental-web-platform-features.
Probing this browser…

what happened

Nothing yet. Tap a ⓘ, then tap a link’s text, and compare.

references (link destinations)

  1. Mason Freed — ChromeStatus owner
  2. Open UI interest invokers explainer
  3. CSSWG issue #12437
  4. CSS Pseudo 4 §4.4

the pattern

<a href="/people/mason" interestfor="card-mason">Mason Freed</a>
<div id="card-mason" popover="hint" role="tooltip">…</div>

@media (any-pointer: coarse) {
  a[interestfor]::interest-button { content: "ⓘ" / ""; }
}
.card { position-area: block-end span-inline-end; }   /* implicit anchor */

Accessibility. The ⓘ is not focusable and not in the accessibility tree, by design: keyboard and screen-reader users reach the same card by focusing the link itself, and the link’s aria-describedby points at the card (added by this page’s script, per the modern-web-guidance tooltip recipe). Fallback. Where the pseudo-element does not render, the page inserts a real <button interestfor popovertarget popovertargetaction="show"> toggletip after each link, drawn with a dashed border and labelled as a fallback — it is a different element, not the feature.

see also