Only use tagname for shortcut filter (#15273)

This commit is contained in:
Bram Kragten 2023-01-30 20:50:57 +01:00 committed by GitHub
parent 41420c3af3
commit c1ed00a3f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,6 @@ import type { PropertyValues } from "lit";
import tinykeys from "tinykeys"; import tinykeys from "tinykeys";
import { isComponentLoaded } from "../common/config/is_component_loaded"; import { isComponentLoaded } from "../common/config/is_component_loaded";
import { mainWindow } from "../common/dom/get_main_window"; import { mainWindow } from "../common/dom/get_main_window";
import { HaSelect } from "../components/ha-select";
import { import {
QuickBarParams, QuickBarParams,
showQuickBar, showQuickBar,
@ -134,20 +133,17 @@ export default <T extends Constructor<HassElement>>(superClass: T) =>
} }
private _canOverrideAlphanumericInput(e: KeyboardEvent) { private _canOverrideAlphanumericInput(e: KeyboardEvent) {
const el = e.composedPath()[0]; const el = e.composedPath()[0] as Element;
if (el instanceof HTMLTextAreaElement) { if (el.tagName === "TEXTAREA") {
return false; return false;
} }
if (el instanceof Element && el.parentElement instanceof HaSelect) { if (el.parentElement?.tagName === "HA-SELECT") {
return false; return false;
} }
if ( if (el.tagName !== "INPUT") {
(el as Element).tagName !== "INPUT" &&
!(el instanceof HTMLInputElement)
) {
return true; return true;
} }