From fb73bfb96402b1f03bcf8c09251c3b34195c0982 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 1 Feb 2024 17:57:08 +0100 Subject: [PATCH] Only show more info on graphs when mouse is used (#19606) only show more info on graphs when mouse is used --- src/components/chart/ha-chart-base.ts | 5 ++++- src/components/chart/state-history-chart-line.ts | 7 ++++++- src/components/chart/state-history-chart-timeline.ts | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/components/chart/ha-chart-base.ts b/src/components/chart/ha-chart-base.ts index ea720e16bc1b..aa4a90fef8d6 100644 --- a/src/components/chart/ha-chart-base.ts +++ b/src/components/chart/ha-chart-base.ts @@ -438,7 +438,10 @@ export class HaChartBase extends LitElement { color: white; border-radius: 4px; pointer-events: none; - z-index: 1000; + z-index: 1; + -ms-user-select: none; + -webkit-user-select: none; + -moz-user-select: none; width: 200px; box-sizing: border-box; direction: var(--direction); diff --git a/src/components/chart/state-history-chart-line.ts b/src/components/chart/state-history-chart-line.ts index 78ec773719c3..5f6286ecef61 100644 --- a/src/components/chart/state-history-chart-line.ts +++ b/src/components/chart/state-history-chart-line.ts @@ -220,7 +220,12 @@ export class StateHistoryChartLine extends LitElement { // @ts-expect-error locale: numberFormatToLocale(this.hass.locale), onClick: (e: any) => { - if (!this.clickForMoreInfo) { + if ( + !this.clickForMoreInfo || + !(e.native instanceof MouseEvent) || + (e.native instanceof PointerEvent && + e.native.pointerType !== "mouse") + ) { return; } diff --git a/src/components/chart/state-history-chart-timeline.ts b/src/components/chart/state-history-chart-timeline.ts index 79b51be40ed3..8bfb0fef8b7f 100644 --- a/src/components/chart/state-history-chart-timeline.ts +++ b/src/components/chart/state-history-chart-timeline.ts @@ -224,7 +224,11 @@ export class StateHistoryChartTimeline extends LitElement { // @ts-expect-error locale: numberFormatToLocale(this.hass.locale), onClick: (e: any) => { - if (!this.clickForMoreInfo) { + if ( + !this.clickForMoreInfo || + !(e.native instanceof MouseEvent) || + (e.native instanceof PointerEvent && e.native.pointerType !== "mouse") + ) { return; }