-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Fix responsive issue when the chart is recreated #4774
Conversation
Chrome specific issue that happens when destroying a chart and re-creating it immediately (same animation frame?). The CSS animation used to detect when the canvas become visible is not re-evaluated, breaking responsiveness. Accessing the `offsetParent` property will force a reflow and re-evaluate the CSS animation.
110050d
to
49d07f0
Compare
Firefox has some issues with the first fix (manually trigger handlers), so simply force a reflow by accessing the |
try { | ||
chart = new Chart(canvas.getContext('2d'), config); | ||
} catch (e) { | ||
window.document.body.removeChild(wrapper); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test was leaking because the chart construction throws and the wrapper/canvas wasn't removed.
@daniele-orlando @frlinw can you have a look at this PR and confirm that it fixes your issue? |
Hi Simon, sorry I'm in Singapore for 2 weeks with just my phone, I'll check when I'll be back in my cold country |
@frlinw have you had a chance to test this? |
Chrome specific issue that happens when destroying a chart and re-creating it immediately (same animation frame?). The CSS animation used to detect when the canvas become visible is not re-evaluated, breaking responsiveness. Accessing the `offsetParent` property will force a reflow and re-evaluate the CSS animation.
Chrome specific issue that happens when destroying a chart and re-creating it immediately (same animation frame?). The CSS animation used to detect when the canvas become visible is not re-evaluated, breaking responsiveness. Accessing the `offsetParent` property will force a reflow and re-evaluate the CSS animation.
Chrome specific issue that happens when destroying a chart and re-creating it immediately (same animation frame?). The CSS animation used to detect when the canvas become visible is not re-evaluated, breaking responsiveness. Accessing the
offsetParent
property will force a reflow and re-evaluate the CSS animation.Fixes #4737