Use key instead of keycode for key event (#16625)
This commit is contained in:
parent
c4ff1a8646
commit
71bb540352
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -105,7 +105,7 @@ export class HaAuthFlow extends LitElement {
|
|||
}
|
||||
|
||||
this.addEventListener("keypress", (ev) => {
|
||||
if (ev.keyCode === 13) {
|
||||
if (ev.key === "Enter") {
|
||||
this._handleSubmit(ev);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ class StepFlowForm extends LitElement {
|
|||
}
|
||||
|
||||
private _handleKeyDown = (ev: KeyboardEvent) => {
|
||||
if (ev.keyCode === 13) {
|
||||
if (ev.key === "Enter") {
|
||||
this._submitStep();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -282,7 +282,7 @@ class OnboardingCoreConfig extends LitElement {
|
|||
100
|
||||
);
|
||||
this.addEventListener("keypress", (ev) => {
|
||||
if (ev.keyCode === 13) {
|
||||
if (ev.key === "Enter") {
|
||||
this._save(ev);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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 &&
|
||||
|
|
|
@ -235,7 +235,7 @@ class DialogThingtalk extends LitElement {
|
|||
};
|
||||
|
||||
private _handleKeyUp(ev: KeyboardEvent) {
|
||||
if (ev.keyCode === 13) {
|
||||
if (ev.key === "Enter") {
|
||||
this._generate();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -296,7 +296,7 @@ export class AssistPipelineRunDebug extends LitElement {
|
|||
}
|
||||
|
||||
private _handleContinueKeyDown(ev) {
|
||||
if (ev.keyCode === 13) {
|
||||
if (ev.key === "Enter") {
|
||||
this._runTextPipeline();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -301,7 +301,7 @@ class HuiShoppingListCard
|
|||
}
|
||||
|
||||
private _addKeyPress(ev): void {
|
||||
if (ev.keyCode === 13) {
|
||||
if (ev.key === "Enter") {
|
||||
this._addItem(null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue