From fb55ab197f77bc33429401dcbf97ce722898bf15 Mon Sep 17 00:00:00 2001 From: Steve Repsher Date: Mon, 31 Jan 2022 18:07:49 -0500 Subject: [PATCH] Mobile click accessibility (#11447) --- src/entrypoints/app.ts | 6 +++++- src/entrypoints/authorize.ts | 3 +++ src/entrypoints/custom-panel.ts | 5 ++++- src/entrypoints/onboarding.ts | 3 +++ src/resources/compatibility.ts | 1 + 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/entrypoints/app.ts b/src/entrypoints/app.ts index d4d1852c2001..e93a38769e85 100644 --- a/src/entrypoints/app.ts +++ b/src/entrypoints/app.ts @@ -1,7 +1,11 @@ -import { setPassiveTouchGestures } from "@polymer/polymer/lib/utils/settings"; +import { + setPassiveTouchGestures, + setCancelSyntheticClickEvents, +} from "@polymer/polymer/lib/utils/settings"; import "../layouts/home-assistant"; import "../resources/ha-style"; import "../resources/roboto"; import "../util/legacy-support"; setPassiveTouchGestures(true); +setCancelSyntheticClickEvents(false); diff --git a/src/entrypoints/authorize.ts b/src/entrypoints/authorize.ts index 36954a3fcf9f..47ba124a9180 100644 --- a/src/entrypoints/authorize.ts +++ b/src/entrypoints/authorize.ts @@ -1,11 +1,14 @@ // Compat needs to be first import import "../resources/compatibility"; +import { setCancelSyntheticClickEvents } from "@polymer/polymer/lib/utils/settings"; import "../auth/ha-authorize"; import "../resources/ha-style"; import "../resources/roboto"; import "../resources/safari-14-attachshadow-patch"; import "../resources/array.flat.polyfill"; +setCancelSyntheticClickEvents(false); + /* polyfill for paper-dropdown */ setTimeout( () => import("web-animations-js/web-animations-next-lite.min"), diff --git a/src/entrypoints/custom-panel.ts b/src/entrypoints/custom-panel.ts index e2da175ea8dc..2e09f9931b49 100644 --- a/src/entrypoints/custom-panel.ts +++ b/src/entrypoints/custom-panel.ts @@ -1,5 +1,6 @@ // Compat needs to be first import import "../resources/compatibility"; +import { setCancelSyntheticClickEvents } from "@polymer/polymer/lib/utils/settings"; import "../resources/safari-14-attachshadow-patch"; import { PolymerElement } from "@polymer/polymer"; @@ -15,6 +16,8 @@ import { createCustomPanelElement } from "../util/custom-panel/create-custom-pan import { loadCustomPanel } from "../util/custom-panel/load-custom-panel"; import { setCustomPanelProperties } from "../util/custom-panel/set-custom-panel-properties"; +setCancelSyntheticClickEvents(false); + declare global { interface Window { loadES5Adapter: () => Promise; @@ -47,7 +50,7 @@ function initialize( ) { const style = document.createElement("style"); - style.innerHTML = `body { margin:0; } + style.innerHTML = `body { margin:0; } @media (prefers-color-scheme: dark) { body { background-color: #111111; diff --git a/src/entrypoints/onboarding.ts b/src/entrypoints/onboarding.ts index 44a67890abc3..78696169ca5a 100644 --- a/src/entrypoints/onboarding.ts +++ b/src/entrypoints/onboarding.ts @@ -1,11 +1,14 @@ // Compat needs to be first import import "../resources/compatibility"; +import { setCancelSyntheticClickEvents } from "@polymer/polymer/lib/utils/settings"; import "../onboarding/ha-onboarding"; import "../resources/ha-style"; import "../resources/roboto"; import "../resources/safari-14-attachshadow-patch"; import "../resources/array.flat.polyfill"; +setCancelSyntheticClickEvents(false); + declare global { interface Window { stepsPromise: Promise; diff --git a/src/resources/compatibility.ts b/src/resources/compatibility.ts index 03a0b23feca9..07f80f0ff8cf 100644 --- a/src/resources/compatibility.ts +++ b/src/resources/compatibility.ts @@ -1,3 +1,4 @@ +// Caution before editing - For latest builds, this module is replaced with emptiness and thus not imported (see build-scripts/bundle.js) import "core-js"; import "regenerator-runtime/runtime"; import "lit/polyfill-support";