diff --git a/cast/src/launcher/layout/hc-connect.ts b/cast/src/launcher/layout/hc-connect.ts index 346b704d78..bd1a5f7436 100644 --- a/cast/src/launcher/layout/hc-connect.ts +++ b/cast/src/launcher/layout/hc-connect.ts @@ -190,7 +190,7 @@ export class HcConnect extends LitElement { private _handleInputKeyDown(ev: KeyboardEvent) { // Handle pressing enter. - if (ev.keyCode === 13) { + if (ev.key === "Enter") { this._handleConnect(); } } diff --git a/hassio/src/dialogs/repositories/dialog-hassio-repositories.ts b/hassio/src/dialogs/repositories/dialog-hassio-repositories.ts index a97cb0907d..aeac743f31 100644 --- a/hassio/src/dialogs/repositories/dialog-hassio-repositories.ts +++ b/hassio/src/dialogs/repositories/dialog-hassio-repositories.ts @@ -218,7 +218,7 @@ class HassioRepositoriesDialog extends LitElement { private _handleKeyAdd(ev: KeyboardEvent) { ev.stopPropagation(); - if (ev.keyCode !== 13) { + if (ev.key !== "Enter") { return; } this._addRepository(); diff --git a/src/auth/ha-auth-flow.ts b/src/auth/ha-auth-flow.ts index b5070dee73..f23733bb79 100644 --- a/src/auth/ha-auth-flow.ts +++ b/src/auth/ha-auth-flow.ts @@ -105,7 +105,7 @@ export class HaAuthFlow extends LitElement { } this.addEventListener("keypress", (ev) => { - if (ev.keyCode === 13) { + if (ev.key === "Enter") { this._handleSubmit(ev); } }); diff --git a/src/components/ha-tab.ts b/src/components/ha-tab.ts index 106ebd6211..e9b01409ca 100644 --- a/src/components/ha-tab.ts +++ b/src/components/ha-tab.ts @@ -54,7 +54,7 @@ export class HaTab extends LitElement { }); private _handleKeyDown(ev: KeyboardEvent): void { - if (ev.keyCode === 13) { + if (ev.key === "Enter") { (ev.target as HTMLElement).click(); } } diff --git a/src/dialogs/config-flow/step-flow-form.ts b/src/dialogs/config-flow/step-flow-form.ts index b855fc786b..8be65a68a9 100644 --- a/src/dialogs/config-flow/step-flow-form.ts +++ b/src/dialogs/config-flow/step-flow-form.ts @@ -93,7 +93,7 @@ class StepFlowForm extends LitElement { } private _handleKeyDown = (ev: KeyboardEvent) => { - if (ev.keyCode === 13) { + if (ev.key === "Enter") { this._submitStep(); } }; diff --git a/src/dialogs/voice-command-dialog/ha-voice-command-dialog.ts b/src/dialogs/voice-command-dialog/ha-voice-command-dialog.ts index 4d3afdac92..e0ec5db5de 100644 --- a/src/dialogs/voice-command-dialog/ha-voice-command-dialog.ts +++ b/src/dialogs/voice-command-dialog/ha-voice-command-dialog.ts @@ -324,7 +324,7 @@ export class HaVoiceCommandDialog extends LitElement { private _handleKeyUp(ev: KeyboardEvent) { const input = ev.target as HaTextField; - if (ev.keyCode === 13 && input.value) { + if (ev.key === "Enter" && input.value) { this._processText(input.value); input.value = ""; this._showSendButton = false; diff --git a/src/onboarding/onboarding-analytics.ts b/src/onboarding/onboarding-analytics.ts index e7aa0502aa..09c19a6f98 100644 --- a/src/onboarding/onboarding-analytics.ts +++ b/src/onboarding/onboarding-analytics.ts @@ -50,7 +50,7 @@ class OnboardingAnalytics extends LitElement { protected firstUpdated(changedProps) { super.firstUpdated(changedProps); this.addEventListener("keypress", (ev) => { - if (ev.keyCode === 13) { + if (ev.key === "Enter") { this._save(ev); } }); diff --git a/src/onboarding/onboarding-core-config.ts b/src/onboarding/onboarding-core-config.ts index 9bf3be1ddb..eef93d1b54 100644 --- a/src/onboarding/onboarding-core-config.ts +++ b/src/onboarding/onboarding-core-config.ts @@ -282,7 +282,7 @@ class OnboardingCoreConfig extends LitElement { 100 ); this.addEventListener("keypress", (ev) => { - if (ev.keyCode === 13) { + if (ev.key === "Enter") { this._save(ev); } }); diff --git a/src/onboarding/onboarding-create-user.ts b/src/onboarding/onboarding-create-user.ts index 86842d21a8..ea24e6b661 100644 --- a/src/onboarding/onboarding-create-user.ts +++ b/src/onboarding/onboarding-create-user.ts @@ -94,7 +94,7 @@ class OnboardingCreateUser extends LitElement { setTimeout(() => this._form?.focus(), 100); this.addEventListener("keypress", (ev) => { if ( - ev.keyCode === 13 && + ev.key === "Enter" && this._newUser.name && this._newUser.username && this._newUser.password && diff --git a/src/panels/config/automation/thingtalk/dialog-thingtalk.ts b/src/panels/config/automation/thingtalk/dialog-thingtalk.ts index 7b06413e2c..dab22a9950 100644 --- a/src/panels/config/automation/thingtalk/dialog-thingtalk.ts +++ b/src/panels/config/automation/thingtalk/dialog-thingtalk.ts @@ -235,7 +235,7 @@ class DialogThingtalk extends LitElement { }; private _handleKeyUp(ev: KeyboardEvent) { - if (ev.keyCode === 13) { + if (ev.key === "Enter") { this._generate(); } } diff --git a/src/panels/config/helpers/forms/ha-input_select-form.ts b/src/panels/config/helpers/forms/ha-input_select-form.ts index 06c5df0cae..95bee14710 100644 --- a/src/panels/config/helpers/forms/ha-input_select-form.ts +++ b/src/panels/config/helpers/forms/ha-input_select-form.ts @@ -130,7 +130,7 @@ class HaInputSelectForm extends LitElement { private _handleKeyAdd(ev: KeyboardEvent) { ev.stopPropagation(); - if (ev.keyCode !== 13) { + if (ev.key !== "Enter") { return; } this._addOption(); diff --git a/src/panels/config/users/dialog-add-user.ts b/src/panels/config/users/dialog-add-user.ts index 04be1f8d58..c8154991ea 100644 --- a/src/panels/config/users/dialog-add-user.ts +++ b/src/panels/config/users/dialog-add-user.ts @@ -73,7 +73,7 @@ export class DialogAddUser extends LitElement { protected firstUpdated(changedProperties: PropertyValues) { super.firstUpdated(changedProperties); this.addEventListener("keypress", (ev) => { - if (ev.keyCode === 13) { + if (ev.key === "Enter") { this._createUser(ev); } }); diff --git a/src/panels/config/voice-assistants/debug/assist-pipeline-run-debug.ts b/src/panels/config/voice-assistants/debug/assist-pipeline-run-debug.ts index d9a496abae..85bba483ae 100644 --- a/src/panels/config/voice-assistants/debug/assist-pipeline-run-debug.ts +++ b/src/panels/config/voice-assistants/debug/assist-pipeline-run-debug.ts @@ -296,7 +296,7 @@ export class AssistPipelineRunDebug extends LitElement { } private _handleContinueKeyDown(ev) { - if (ev.keyCode === 13) { + if (ev.key === "Enter") { this._runTextPipeline(); } } diff --git a/src/panels/lovelace/cards/hui-shopping-list-card.ts b/src/panels/lovelace/cards/hui-shopping-list-card.ts index 2c53ce6a71..0a6b08d6d3 100644 --- a/src/panels/lovelace/cards/hui-shopping-list-card.ts +++ b/src/panels/lovelace/cards/hui-shopping-list-card.ts @@ -301,7 +301,7 @@ class HuiShoppingListCard } private _addKeyPress(ev): void { - if (ev.keyCode === 13) { + if (ev.key === "Enter") { this._addItem(null); } } diff --git a/src/panels/profile/ha-change-password-card.ts b/src/panels/profile/ha-change-password-card.ts index b4b3e0a7b1..2c0a132656 100644 --- a/src/panels/profile/ha-change-password-card.ts +++ b/src/panels/profile/ha-change-password-card.ts @@ -118,7 +118,7 @@ class HaChangePasswordCard extends LitElement { super.firstUpdated(changedProps); this.addEventListener("keypress", (ev) => { this._statusMsg = undefined; - if (ev.keyCode === 13) { + if (ev.key === "Enter") { this._changePassword(); } });