From 6cd8ee9253873f467a9387bdbf2e9aa856ce07a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joni=20K=C3=A4ki-M=C3=A4kel=C3=A4?= Date: Wed, 31 Jan 2024 01:15:41 +0200 Subject: [PATCH] Disable pointer-events for tile-card .icon-container class that don't have a "button" role (#19497) Set pointer-events to none for icon containers that don't have button role --- gallery/src/pages/lovelace/tile-card.ts | 12 ++++++++++++ src/panels/lovelace/cards/hui-tile-card.ts | 3 +++ 2 files changed, 15 insertions(+) diff --git a/gallery/src/pages/lovelace/tile-card.ts b/gallery/src/pages/lovelace/tile-card.ts index b161b51a52..7113f4d048 100644 --- a/gallery/src/pages/lovelace/tile-card.ts +++ b/gallery/src/pages/lovelace/tile-card.ts @@ -79,6 +79,18 @@ const CONFIGS = [ color: pink `, }, + { + heading: "Whole tile tap action", + config: ` +- type: tile + entity: switch.tv_outlet + color: pink + tap_action: + action: toggle + icon_tap_action: + action: none + `, + }, { heading: "Unknown entity", config: ` diff --git a/src/panels/lovelace/cards/hui-tile-card.ts b/src/panels/lovelace/cards/hui-tile-card.ts index e400e147ce..98faa89eaf 100644 --- a/src/panels/lovelace/cards/hui-tile-card.ts +++ b/src/panels/lovelace/cards/hui-tile-card.ts @@ -525,6 +525,9 @@ export class HuiTileCard extends LitElement implements LovelaceCard { top: -3px; right: -3px; } + .icon-container:not([role="button"]) { + pointer-events: none; + } .icon-container[role="button"]:focus-visible, .icon-container[role="button"]:active { transform: scale(1.2);