Fix uncaught exception in quick-bar mixin (#15061)

This commit is contained in:
Steve Repsher 2023-01-21 22:23:14 -05:00 committed by GitHub
parent 522c7c08a9
commit fd22afedd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@ 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,
@ -133,17 +134,17 @@ export default <T extends Constructor<HassElement>>(superClass: T) =>
} }
private _canOverrideAlphanumericInput(e: KeyboardEvent) { private _canOverrideAlphanumericInput(e: KeyboardEvent) {
const el = e.composedPath()[0] as any; const el = e.composedPath()[0];
if (el.tagName === "TEXTAREA") { if (el instanceof HTMLTextAreaElement) {
return false; return false;
} }
if (el.parentElement.tagName === "HA-SELECT") { if (el instanceof Element && el.parentElement instanceof HaSelect) {
return false; return false;
} }
if (el.tagName !== "INPUT") { if (!(el instanceof HTMLInputElement)) {
return true; return true;
} }