Skip to content

fix(site/src): make hover tooltips hoverable and persistent - #30891

Open
chrifro wants to merge 3 commits into
mainfrom
fix-tooltip-hover-content
Open

chrifro wants to merge 3 commits into
mainfrom
fix-tooltip-hover-content

Conversation

@chrifro

@chrifro chrifro commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Fixes WCAG 1.4.13 (content on hover or focus) for the user menu and chart tooltips: you can now move the pointer onto them without them disappearing, and Escape dismisses them.

  • User menu (UserDropdownContent.tsx): the "Browse the source code" and "Copy deployment ID" tooltips used disableHoverableContent, and Radix Menu moves focus from an item to the menu on pointerleave, which blurred the trigger and closed the tooltip. The items now preventDefault on pointerleave so they keep focus. The tooltips also move to side="left" so they sit outside the menu instead of covering the next item. Escape closes only the tooltip; the menu stays open.
  • Charts (components/Chart/Chart.tsx): Recharts tooltips followed the pointer with pointer-events: none, so they could never be reached. ChartTooltip is now a wrapper that centers the tooltip above the active point at the top of the plot, enables pointer events on the content, and stops mousemove from reaching the chart while the pointer is over it, so the active point doesn't change. Recharts already dismisses it on Escape. This applies to all ChartTooltip users: deployment overview user engagement, template insights active users, and license seat consumption.

Trade-off for UX review: the chart tooltip occupies a band at the top of the plot. Hovering in that band lands on the tooltip, so you can't scrub along the chart there, and it can cover the highest part of the line.

Fixes DEQ-566, DEQ-324

Proof

Real pointer moved from the trigger onto the tooltip (red dot marks the pointer). Captured from Storybook.

Before After
User menu menu before menu after
Chart chart before chart after

Before: the menu tooltip closes, and the chart tooltip slides away from the pointer. After: both stay under the pointer.

Tests

  • UserDropdownContent.test.tsx: the version item keeps focus on pointerleave (fails on main).
  • Chart.stories.tsx TooltipHovered: activates a point by keyboard and hovers the tooltip (fails on main with pointer-events: none).
  • Also checked in a real browser (Playwright against scripts/develop.sh): tooltips stay while hovered, Escape dismisses, keyboard focus still opens the menu tooltips.
Implementation notes
  • ChartTooltip sets displayName = "Tooltip" because Recharts finds the tooltip among chart children by display name.
  • The content element passed to Recharts is a stable component (HoverableTooltipContent) so it isn't remounted under the pointer on every render.
  • Tooltip width is measured with a ResizeObserver in a stable callback ref, to center and clamp the tooltip within the plot.
  • ChartTooltip's content is now typed as a required React.ReactElement; all existing callers already pass <ChartTooltipContent />.
  • Ran the frontend-deep-review skill; all blocking/should-fix findings were addressed.

Generated by Coder Agents on behalf of @chrifro.

User menu version and deployment ID tooltips closed as soon as the
pointer left the menu item, and Recharts tooltips followed the pointer
with pointer events disabled, so neither could be hovered (WCAG 1.4.13).

Keep focus on the menu items on pointerleave so their tooltips stay
open, and place them beside the menu. Wrap ChartTooltip so it sits
above the active point at the top of the plot, accepts pointer events,
and keeps its data while hovered. Escape still dismisses both.
@chrifro chrifro closed this Oct 16, 2026
@chrifro chrifro reopened this Oct 16, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 16, 2026
…tent

# Conflicts:
#	site/src/components/Chart/Chart.stories.tsx
#	site/src/components/Chart/Chart.tsx
@chrifro
chrifro requested a review from aqandrew October 16, 2026 11:41
@chrifro
chrifro marked this pull request as ready for review October 16, 2026 11:41
Stop mousemove propagation on the tooltip instead of freezing its data,
and drop user menu stories that do not catch regressions.

This branch has not been deployed

No deployments
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant