Repository navigation
Description
Summary
HoverCard and Tooltip are only reachable via mouse hover / keyboard focus today. On touch devices there is no way to reveal them:
useHoverCardbinds onlymouseenter/mouseleave/focusin/focusout. On a phone/tablet there is no primary hover, so uncontrolled HoverCards effectively never open (short of a controlledopenprop wired up by the consumer).useTooltipgoes further and deliberately suppresses itself on touch:handleMouseEnterearly-returns whenwindow.matchMedia('(hover: none)').matches, because the emulated hover would otherwise eat the tap. So a plainTooltipshows nothing at all on mobile.
Net effect: any information conveyed only through a HoverCard/Tooltip is invisible to touch users. We should define and ship a first-class mobile activation path.
Proposed direction (to be scoped)
Initial instinct is long-press to reveal on touch. It's a common convention, keeps a single tap free for the trigger's primary action, and doesn't require an always-visible affordance. But long-press carries real tradeoffs — especially accessibility — that need to be teased out before we commit. Capturing the research below so the scoping conversation starts from evidence, not vibes.
AX and UX concerns with long-press specifically
- Screen-reader gesture conflict. Long-press is not a screen-reader-native gesture. Under VoiceOver / TalkBack the touch model changes entirely (explore-by-touch, double-tap to activate, swipe to move focus), so a raw
touchstart+timer long-press won't fire the way it does for sighted touch users. Whatever we build must also expose the content through the accessibility tree (e.g.aria-describedbyon the trigger so the SR announces it), independent of the long-press gesture. Long-press alone would leave SR users with no path — arguably worse than today because it looks solved. - Discoverability. A long-press affordance is invisible. Sighted touch users have no cue that content is hidden behind a press-and-hold. HoverCard already supports a dashed-underline hover indication; we'd want an equivalent, touch-appropriate affordance (or lean on the trigger being an obviously-interactive element).
- Gesture collisions. Long-press already means "select text / show context menu / magnifier callout" on iOS and Android, and browsers fire the
contextmenuevent. We'd need to manage-webkit-touch-callout,user-select, andcontextmenucarefully so we don't break native selection or double-fire. - Timing & motor accessibility. Press-and-hold thresholds are hostile to users with motor/tremor conditions and to WCAG 2.5.x expectations around timing. If we require a hold, the duration must be reasonable and ideally not the only way in.
- Dismiss / persist / hoverable (WCAG 1.4.13). Content on hover-or-focus must be dismissable, persistent, and hoverable. The touch equivalent needs an explicit dismiss (tap-outside / close affordance) and must not vanish on an incidental touch-move.
What's in the wild
@media (hover: none)/(pointer: coarse)is the standard signal for "no reliable hover" — already used in the Tooltip suppression logic. This is the right gate for any touch-specific behavior. (CSS Media Queries L4 interaction media features.)- Tap-to-toggle is the most common non-hover pattern: first tap reveals, tap-outside/second interaction dismisses. Simpler and more discoverable than long-press, but it competes with the trigger's own click/navigation action — fine for a bare info icon, problematic when the trigger is itself a link/button.
- GitHub hovercards solved the keyboard path (focus + dismiss) but hovercards there are still largely a pointer affordance; the lesson is that the accessible fallback is a separate, explicit mechanism, not the same gesture.
- Guidance is consistent that tooltips must not be the sole carrier of essential info, and that content-on-hover must satisfy WCAG 1.4.13 (dismissable / hoverable / persistent). Deque/USWDS/Tippy.js all land here.
Open questions for scoping
- Long-press vs tap-to-toggle vs "trigger becomes a real button that opens a popover on tap" — likely differs between
Tooltip(presentational, short text) andHoverCard(richer, potentially interactive content). - For
Tooltipspecifically: is the right mobile answer to not try to show it on touch at all, and instead require essential info to live elsewhere? (i.e. is the current suppression actually correct, and the bug is only that we don't document/enforce the "don't hide essential info in a tooltip" rule?) - Do we need a shared primitive (a
useTouchRevealgate keyed on(hover: none)) so HoverCard and Tooltip behave consistently? - What's the accessible-tree contract regardless of gesture (aria wiring so SR users always get the content)?
Acceptance criteria (draft)
- Decision recorded on the mobile activation model for
Tooltipand forHoverCard(may differ). - Whatever gesture we pick, the content is also exposed to assistive tech independent of the gesture.
- Behavior gated on
@media (hover: none)/ coarse pointer so desktop is unaffected. - Satisfies WCAG 1.4.13 (dismissable, persistent, hoverable-equivalent) and doesn't break native text selection / context menu.
- Story + docs showing the mobile interaction.
Filed for scoping — the long-press instinct is a starting point, not a decision. Needs design review before build.
Activity
mohityadav8 commentedon Jul 12, 2026
@cixzhang can i work on this
cixzhang commentedon Jul 12, 2026
@mohityadav8 thanks for the eagerness :) At the moment though, I'm not sure what the right solution is here. Curious if you've had experience with behaviors like this in the wild and what's worked well. For our internal tools, we've been mostly desktop focused, so these mobile behaviors are still very exploratory for us.
gonzoblasco commentedon Jul 16, 2026
Great write-up — the long-press vs tap-to-toggle tradeoff is exactly the right conversation to have early.
A few thoughts from working on accessible component libraries:
On the hybrid approach: I think the right answer depends on the trigger type, not a one-size-fits-all gesture:
On the screen reader concern (point 1): this is critical and often overlooked. Whatever touch gesture we pick, the content must also be exposed through the accessibility tree independently. Using
aria-describedbyon the trigger is the most reliable path — the screen reader announces the tooltip content when the user focuses the trigger, without needing any gesture at all. This also satisfies WCAG 1.4.13's "persistent" requirement since the content is in the accessibility tree regardless of interaction state.On discoverability (point 2): for long-press, a subtle visual affordance helps — like a dotted underline on the trigger text (GitHub hovercards do this well) or a small chevron/ellipsis indicator. For toggletap, the trigger being a focusable
<button>with a cursor change is usually sufficient.On WCAG 1.4.13: worth noting that the "dismissable" requirement means a tap-outside or Escape key must close the tooltip. For long-press, this is trickier because the user didn't explicitly "open" anything — they held, and content appeared. A tap-outside dismiss works, but the user might not know they need to dismiss. Toggletip is cleaner here: the user tapped to open, so tapping again or tapping outside to close is intuitive.
On timing (point 4): if long-press is used, the duration should be configurable (300-800ms range) and should not be the only path — keyboard focus plus
aria-describedbymust always work as a fallback.Happy to help test whatever direction you settle on.
gonzoblasco commentedon Aug 3, 2026
@cubernetes not sure if you've landed on an answer yet, but this is the kind of problem I've been spending too much time on, so I want to push on the specifics.
I think the trap here is treating
TooltipandHoverCardthe same — they're different problems.On
Tooltip: I'm leaning toward less, not more. Right nowuseTooltipsuppresses on(hover: none)and that's arguably correct. Tooltips are for transient hint text (icon labels, truncated values), not for information users might need to read. If the design system actively forbids putting required content in a tooltip (docs + lint rule + composition-only API), the mobile problem disappears because there's nothing essential being hidden. The current behavior becomes a feature, not a bug.The win we give up: better touch discoverability for presentational tooltips. But that's a UX nice-to-have, not a correctness issue.
On
HoverCard: this is where the work is, because HoverCard content is often interactive (commit refs, user bios, link previews). Here I'd propose toggletip, not long-press:The
interactivecheck matters — a HoverCard wrapping a link shouldn't swallow the link's navigation. That's the trap with naive tap-to-toggle.The accessibility contract that has to hold regardless of gesture is the part I want to nail. Whatever activation model we pick, the content has to be reachable through the a11y tree independently. Two mechanisms, both cheap:
aria-describedbyon the trigger pointing at the HoverCard content's id. Screen reader users get the content announced when they focus the trigger — no gesture needed.If we did this, the gesture question becomes mostly about sighted touch UX. Screen reader users get content through
aria-describedbyeither way. Keyboard users already work. Sighted mouse users already work. We're only solving for sighted-finger-without-hover, which is the smallest population — so erring on the simple, debuggable side (toggletip) over the clever side (long-press) seems right.What I'd push back on for the long-press instinct specifically:
contextmenuon long-press, which means you also have to suppress that or you double-handle.Worth noting: GitHub's hovercards ship the exact pattern I'm proposing here (toggletip on focus + dismiss button), and their docs explicitly call out that hovercards are not the primary navigation path — that's the link itself. That's the model we should be amplifying, not inventing around.
If this direction is interesting, I can sketch the API + a reference implementation + tests covering:
(hover: none)path opens on tap, closes on tap-outside / Escaria-describedbywithout gestureHappy to take this as a draft spec + PR if it's useful. Also happy to be wrong about any of the above — the parts I'm least sure on are (a) whether the team wants HoverCard to swallow tap on wrapped links or defer to them, and (b) whether to make the touch behavior opt-in via prop or default-on.
Small context that might be relevant: I just filed a broader contrast audit across the design system in #4652, so I have a fresh read on the tokens and primitives. Happy to cross-reference that with whatever ends up here.
cixzhang commentedon Aug 21, 2026
Resolved by #5248 (mobile access for HoverCard/Tooltip).
gonzoblasco commentedon Aug 21, 2026
Following up now that #5248 landed - glad to see the direction it took, since it matches the accessibility contract I sketched in my comment back in July (issuecomment-4991984976).
The pieces that line up with the "toggletip, not long-press" proposal:
aria-describedbyexposed on the trigger so screen reader users get the content announced on focus, with no gesture requiredisActionTriggerkeeping a wrapped button/link/form control's own tap intact instead of swallowing it - the interactive-check guard I flagged as the trap with naive tap-to-toggleFor the record, the one thing I proposed that does not appear here is an explicit visible close affordance inside the card (I suggested it alongside Escape for 1.4.13). Escape + outside-tap cover dismissal, so it is not a compliance gap - just flagging that a visible dismiss button is the more discoverable option for touch users who may not know the tap-outside gesture.
Nice implementation and test coverage - the pointer-type-per-interaction decision (stylus as hover) is a smart touch. Glad the touch path is finally reachable.