Timing of chart.update('none')
causing hover state to get stuck
#11979
Labels
chart.update('none')
causing hover state to get stuck
#11979
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 happensReproducible 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
The text was updated successfully, but these errors were encountered: