From a952b880d8da39ff0f05b7a8140e05474575ef4f Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Thu, 26 Jun 2025 15:25:26 +0200 Subject: [PATCH] Disable escape key to close edit card dialog (#25947) --- .../card-editor/hui-dialog-edit-card.ts | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/src/panels/lovelace/editor/card-editor/hui-dialog-edit-card.ts b/src/panels/lovelace/editor/card-editor/hui-dialog-edit-card.ts index ed1a507966..a72abfec65 100644 --- a/src/panels/lovelace/editor/card-editor/hui-dialog-edit-card.ts +++ b/src/panels/lovelace/editor/card-editor/hui-dialog-edit-card.ts @@ -74,8 +74,6 @@ export class HuiDialogEditCard @state() private _dirty = false; - @state() private _isEscapeEnabled = true; - public async showDialog(params: EditCardDialogParams): Promise { this._params = params; this._GUImode = true; @@ -93,9 +91,6 @@ export class HuiDialogEditCard } public closeDialog(): boolean { - this._isEscapeEnabled = true; - window.removeEventListener("dialog-closed", this._enableEscapeKeyClose); - window.removeEventListener("hass-more-info", this._disableEscapeKeyClose); if (this._dirty) { this._confirmCancel(); return false; @@ -124,16 +119,6 @@ export class HuiDialogEditCard } } - private _enableEscapeKeyClose = (ev: any) => { - if (ev.detail.dialog === "ha-more-info-dialog") { - this._isEscapeEnabled = true; - } - }; - - private _disableEscapeKeyClose = () => { - this._isEscapeEnabled = false; - }; - protected render() { if (!this._params || !this._cardConfig) { return nothing; @@ -170,7 +155,7 @@ export class HuiDialogEditCard