Fix tap firing twice on iOS (#4841)

This commit is contained in:
Bram Kragten 2020-02-12 13:47:56 +01:00
parent 50d0671abe
commit 97a6354a72
2 changed files with 5 additions and 3 deletions

View File

@ -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 {

View File

@ -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 });