Skip to content

Commit

Permalink
Fix tap firing twice on iOS (#4841)
Browse files Browse the repository at this point in the history
  • Loading branch information
bramkragten committed Feb 12, 2020
1 parent 50d0671 commit 97a6354
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/panels/lovelace/cards/hui-entity-button-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -203,7 +206,6 @@ class HuiEntityButtonCard extends LitElement implements LovelaceCard {
ha-card:focus {
outline: none;
background: var(--divider-color);
}
ha-icon {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down

0 comments on commit 97a6354

Please sign in to comment.