From 7133dc56883004c8c216428eb5da6844efe4453f Mon Sep 17 00:00:00 2001 From: Petar Petrov Date: Tue, 7 Jan 2025 14:44:56 +0200 Subject: [PATCH] Fix tooltip scrolling (#23616) --- src/components/chart/ha-chart-base.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/chart/ha-chart-base.ts b/src/components/chart/ha-chart-base.ts index 017a5dab07..92c660dcfe 100644 --- a/src/components/chart/ha-chart-base.ts +++ b/src/components/chart/ha-chart-base.ts @@ -83,11 +83,13 @@ export class HaChartBase extends LitElement { public disconnectedCallback() { super.disconnectedCallback(); + window.removeEventListener("scroll", this._handleScroll, true); this._releaseCanvas(); } public connectedCallback() { super.connectedCallback(); + window.addEventListener("scroll", this._handleScroll, true); if (this.hasUpdated) { this._releaseCanvas(); this._setupChart(); @@ -561,6 +563,10 @@ export class HaChartBase extends LitElement { this.chart?.resetZoom(); } + private _handleScroll = () => { + this._tooltip = undefined; + }; + static get styles(): CSSResultGroup { return css` :host {