Skip to content

Fix stuck tooltip in legacy line charts when pointer leaves without moving - #7183

Open
Axfff wants to merge 1 commit into
tensorflow:masterfrom
Axfff:fix/scalar-tooltip-stuck-on-window-leave
Open

Axfff wants to merge 1 commit into
tensorflow:masterfrom
Axfff:fix/scalar-tooltip-stuck-on-window-leave

Conversation

@Axfff

@Axfff Axfff commented Dec 3, 2026

Copy link
Copy Markdown

Motivation for features / changes

Fixes #3753.

In the Scalars dashboard (and the other dashboards built on vz-line-chart2: Custom Scalars, PR Curves, HParams), the hover tooltip stays on screen when the pointer leaves a chart without moving across its edge. Two ways to trigger it:

The tooltip only goes away after hovering the same chart again and leaving it through an edge. The Time Series dashboard is not affected because its chart listens for mouseleave.

Technical description of changes

The legacy charts use a forked Plottable Pointer interaction (vz_chart_helpers/plottable-interactions.ts). Its mouse dispatcher listens on the chart's root element instead of document, for Shadow DOM compatibility. Plottable decides whether the pointer left a component only from the coordinates of each mouse event, and it handles mouseout as a move.

Because the listener is scoped to the chart, that mouseout is the last event the chart receives. When the pointer leaves without crossing the edge (onto an element overlapping the chart, or out of the window), the coordinates are still inside the plot. The event is handled as an ordinary move, so the exit callbacks that hide the tooltip never run.

This change sends mouse events in PointerInteraction through a small wrapper. A mouseout whose relatedTarget is outside the chart's root element, or is null (the pointer left the window), is handled as an exit whatever its coordinates. All other events go through Plottable's existing logic unchanged.

Screenshots of UI changes (or N/A)

N/A. This fixes behavior and has no visual change.

Detailed steps to verify changes work correctly (as executed by you)

I loaded the original and the patched plottable-interactions.ts side by side with Plottable 3.13.0, the version in yarn.lock. Each chart was rendered inside a shadow root like vz-line-chart2, with the tooltip shown and hidden from onPointerMove/onPointerExit.

  1. Mouseover for plot does not go away when changing from scalars to images  #3753 repro with real mouse events: I placed a fixed bar over the top of both charts, hovered each chart below the bar, then moved straight up onto the bar. Original: the tooltip stays visible and no exit fires. Patched: the tooltip is hidden.
  2. Window losing the pointer: I dispatched mouseout with relatedTarget: null at the pointer's current position, which is what the browser sends when the window loses the pointer. Original: the tooltip stays visible. Patched: the tooltip is hidden.
  3. Regressions on the patched chart: re-entering the chart shows the tooltip again, and a mouseout between two elements inside the chart keeps it. Moving onto the axis area or off the chart hides it, as before.
  4. tsc type-check of the file with the lax config this target uses, and prettier --check, both pass.

Not run: the full Bazel build (bazel run //tensorboard).

Alternate designs / implementations considered (or N/A)

  • A separate mouseleave listener on the chart root in line-chart.ts. It works the same way, but it needs its own listener lifecycle. Fixing the shared PointerInteraction keeps all exit detection in one place.
  • Hiding tooltips on window blur or visibilitychange. The tooltip already hides on visibilitychange, and neither event covers the overlay case in Mouseover for plot does not go away when changing from scalars to images  #3753.

🤖 Generated with Claude Code

@google-cla

google-cla Bot commented Dec 3, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

…oving

The forked Plottable Pointer interaction listens on the chart's root
element instead of the document, and Plottable decides whether the
pointer exited a component only from the event coordinates. A mouseout
whose coordinates are still inside the plot (the pointer moved onto an
element overlapping the chart, or left the window via macOS Mission
Control or an app switch) was handled as a move, so the tooltip stayed
until the chart was hovered and left again.

Treat a mouseout towards an element outside the chart, or towards no
element at all, as a pointer exit.

Fixes tensorflow#3753.
@Axfff
Axfff force-pushed the fix/scalar-tooltip-stuck-on-window-leave branch from cd47985 to 31ec643 Compare December 3, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mouseover for plot does not go away when changing from scalars to images

1 participant