From 97a6354a72cf12cb8473d8c596f69753505e0da4 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 12 Feb 2020 13:47:56 +0100 Subject: [PATCH] Fix tap firing twice on iOS (#4841) --- src/panels/lovelace/cards/hui-entity-button-card.ts | 6 ++++-- .../lovelace/common/directives/action-handler-directive.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/panels/lovelace/cards/hui-entity-button-card.ts b/src/panels/lovelace/cards/hui-entity-button-card.ts index c6cccaadb8..707e4f60ed 100644 --- a/src/panels/lovelace/cards/hui-entity-button-card.ts +++ b/src/panels/lovelace/cards/hui-entity-button-card.ts @@ -138,7 +138,10 @@ class HuiEntityButtonCard extends LitElement implements LovelaceCard { hasDoubleClick: hasAction(this._config!.double_tap_action), })} tabindex=${ifDefined( - hasAction(this._config.tap_action) ? "0" : undefined + hasAction(this._config.tap_action) || + this._config.tap_action === undefined + ? "0" + : undefined )} > ${this._config.show_icon @@ -203,7 +206,6 @@ class HuiEntityButtonCard extends LitElement implements LovelaceCard { ha-card:focus { outline: none; - background: var(--divider-color); } ha-icon { diff --git a/src/panels/lovelace/common/directives/action-handler-directive.ts b/src/panels/lovelace/common/directives/action-handler-directive.ts index 87c5168019..a4e3a2b1ac 100644 --- a/src/panels/lovelace/common/directives/action-handler-directive.ts +++ b/src/panels/lovelace/common/directives/action-handler-directive.ts @@ -177,7 +177,7 @@ class ActionHandler extends HTMLElement implements ActionHandler { } else { fireEvent(element, "action", { action: "tap" }); } - window.setTimeout(() => (this.touch = undefined), 100); + window.setTimeout(() => (this.touch = undefined), this.holdTime); }; element.addEventListener("touchstart", touchStart, { passive: true });