Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timing of chart.update('none') causing hover state to get stuck #11979

Open
alex-statsig opened this issue Dec 16, 2024 · 0 comments
Open

Timing of chart.update('none') causing hover state to get stuck #11979

alex-statsig opened this issue Dec 16, 2024 · 0 comments

Comments

@alex-statsig
Copy link

alex-statsig commented Dec 16, 2024

Expected behavior

Hovered elements should leave the hovered state when no longer hovered, even if an update is triggered without animations during the animation.

Current behavior

Some elements get stuck in the hovered state, only recovering back to the unhovered state once another chart.update('none') call happens

Reproducible sample

https://codepen.io/alexrcoleman/pen/JoPErdL

Optional extra steps/info to reproduce

In this sample, a plugin triggers chart.update('none') when the mouse moves near the dataset. Move the mouse across the dataset to trigger the update while simultaneously triggering the hover state. I've attached a sample video showing the behavior; its fairly easy to repro a glitchy hover state lagging behind the cursor, but a bit more finicky to reach the bug where it actually gets stuck.

Screen.Recording.2024-12-16.at.12.15.00.PM.mov

Note that I think this is a fairly minimal repro - the tooltip must be disabled or else moving the mouse causes updates that clear the bug. The points must have both a hoverBorderColor and hoverBackgroundColor set. The pointRadius/hoverPointRadius was not needed but makes the issue more apparent.

Possible solution

No response

Context

I have a plugin which highlights the hovered dataset by updating its color and calling chart.update('none') (using 'none' to avoid more expensive animation-based renders). This is causing points in the chart to get stuck in the hover state, looking really broken.

chart.js version

latest

Browser name and version

Chrome

Link to your project

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant