Skip to content

Commit

Permalink
This adds back mobile click accessibility (#11693)
Browse files Browse the repository at this point in the history
  • Loading branch information
bramkragten authored Feb 15, 2022
1 parent ba63ab8 commit 68a4118
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/entrypoints/app.ts
Original file line number Diff line number Diff line change
@@ -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);
3 changes: 3 additions & 0 deletions src/entrypoints/authorize.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// 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);
6 changes: 5 additions & 1 deletion src/entrypoints/custom-panel.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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<unknown>;
Expand Down Expand Up @@ -47,7 +50,8 @@ 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;
Expand Down
3 changes: 3 additions & 0 deletions src/entrypoints/onboarding.ts
Original file line number Diff line number Diff line change
@@ -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<Response>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import "@polymer/paper-dropdown-menu/paper-dropdown-menu";
import "@polymer/paper-input/paper-input";
import "@polymer/paper-item/paper-item";
import "@polymer/paper-listbox/paper-listbox";
import { setCancelSyntheticClickEvents } from "@polymer/polymer/lib/utils/settings";
import { html } from "@polymer/polymer/lib/utils/html-tag";
/* eslint-plugin-disable lit */
import { PolymerElement } from "@polymer/polymer/polymer-element";
Expand Down Expand Up @@ -519,6 +520,14 @@ class HaConfigZwave extends LocalizeMixin(EventsMixin(PolymerElement)) {
);
}

attached() {
setCancelSyntheticClickEvents(true);
}

detached() {
setCancelSyntheticClickEvents(false);
}

serviceCalled(ev) {
if (ev.detail.success && ev.detail.service === "set_poll_intensity") {
this._saveEntity();
Expand Down

0 comments on commit 68a4118

Please sign in to comment.