From 0458d9c63583d27cdf29626a36e95bc5e5f29ab0 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 7 Dec 2018 18:17:10 +0100 Subject: [PATCH 1/2] Fix long press in FF --- src/panels/lovelace/common/directives/long-press-directive.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/panels/lovelace/common/directives/long-press-directive.ts b/src/panels/lovelace/common/directives/long-press-directive.ts index 718ccbafabda..ee25fb2045fc 100644 --- a/src/panels/lovelace/common/directives/long-press-directive.ts +++ b/src/panels/lovelace/common/directives/long-press-directive.ts @@ -110,7 +110,9 @@ class LongPress extends HTMLElement implements LongPress { const clickEnd = (ev: Event) => { if ( this.cooldownEnd || - (ev instanceof TouchEvent && this.timer === undefined) + ("TouchEvent" in window && + ev instanceof TouchEvent && + this.timer === undefined) ) { return; } From 12fef84b034010e6210e90eb2d1fc03c5e00d2be Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 8 Dec 2018 11:54:25 +0100 Subject: [PATCH 2/2] Better fix --- src/panels/lovelace/common/directives/long-press-directive.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/panels/lovelace/common/directives/long-press-directive.ts b/src/panels/lovelace/common/directives/long-press-directive.ts index ee25fb2045fc..879a0f308914 100644 --- a/src/panels/lovelace/common/directives/long-press-directive.ts +++ b/src/panels/lovelace/common/directives/long-press-directive.ts @@ -110,8 +110,7 @@ class LongPress extends HTMLElement implements LongPress { const clickEnd = (ev: Event) => { if ( this.cooldownEnd || - ("TouchEvent" in window && - ev instanceof TouchEvent && + (["touchend", "touchcancel"].includes(ev.type) && this.timer === undefined) ) { return;