chartjs / chartjs/Chart.js

Tooltip doesn't close when mouse leaves the chart area

Open
#11,972 0 comments 2 reactions 0 assignees View on GitHub
type: bug
Dominant language
JavaScript
Stars
67.7k
Forks
11.9k
Avg merge
7h 39m
Merged PRs (30d)
5

Description

### Expected behavior

The tooltip should be closed when the mouse is not hovering a chart element and is outside the chart area.

### Current behavior

If a point is at the edge of the chart area and the mouse goes outside the chart area at the same time as it stops hovering the point, the tooltip stays open while the mouse is inside the canvas but outside the chart area.

Note where my mouse is in the screenshot and that the tooltip is still open.

![image](https://github.com/user-attachments/assets/0986bb09-6ed4-45d8-a642-c6969fad215e)

### Reproducible sample

https://www.chartjs.org/docs/latest/charts/line.html

### Optional extra steps/info to reproduce

1. Go on the sample page for line charts https://www.chartjs.org/docs/latest/charts/line.html
2. Hover the left-most point of the chart
3. Slightly move your mouse to the left, so it's still inside the canvas but outside the chart area, and not hovering the point
4. The tooltip is still open. You can move your mouse all over the canvas while staying outside the chart area, and the tooltip will stay open.

### Possible solution

_No response_

### Context

The issue becomes quite visible and annoying if the chart have big margins between the edge of the canvas and the chart area (eg. big padding in layout, or long axis tick labels)

### chart.js version

v4.4.7

### Browser name and version

Chrome Version 129.0.6668.89

### Link to your project

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.