Fix issue with toggles blocking dialog and dialog launching on mobile (#7506)

* Fix issue with some inputs blocking, or incorrectly allowing, keyboard shortcut activation

* Explicitly declare all input types that we can allow alphanumeric overrides

* Do not launch dialog in codemirror targets on mobile devices
This commit is contained in:
Donnie
2020-10-29 09:18:47 -07:00
committed by GitHub
parent d26f1fa371
commit c7f5c6c1d1
2 changed files with 34 additions and 8 deletions

View File

@@ -81,6 +81,7 @@ export class HaCodeEditor extends UpdatingElement {
protected firstUpdated(changedProps: PropertyValues): void {
super.firstUpdated(changedProps);
this._blockKeyboardShortcuts();
this._load();
}
@@ -232,6 +233,10 @@ export class HaCodeEditor extends UpdatingElement {
this.codemirror!.on("changes", () => this._onChange());
}
private _blockKeyboardShortcuts() {
this.addEventListener("keydown", (ev) => ev.stopPropagation());
}
private _onChange(): void {
const newValue = this.value;
if (newValue === this._value) {