mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +00:00
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) {
|
private _handleInputKeyDown(ev: KeyboardEvent) {
|
||||||
// Handle pressing enter.
|
// Handle pressing enter.
|
||||||
if (ev.keyCode === 13) {
|
if (ev.key === "Enter") {
|
||||||
this._handleConnect();
|
this._handleConnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ class HassioRepositoriesDialog extends LitElement {
|
|||||||
|
|
||||||
private _handleKeyAdd(ev: KeyboardEvent) {
|
private _handleKeyAdd(ev: KeyboardEvent) {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
if (ev.keyCode !== 13) {
|
if (ev.key !== "Enter") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._addRepository();
|
this._addRepository();
|
||||||
|
@ -105,7 +105,7 @@ export class HaAuthFlow extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.addEventListener("keypress", (ev) => {
|
this.addEventListener("keypress", (ev) => {
|
||||||
if (ev.keyCode === 13) {
|
if (ev.key === "Enter") {
|
||||||
this._handleSubmit(ev);
|
this._handleSubmit(ev);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -54,7 +54,7 @@ export class HaTab extends LitElement {
|
|||||||
});
|
});
|
||||||
|
|
||||||
private _handleKeyDown(ev: KeyboardEvent): void {
|
private _handleKeyDown(ev: KeyboardEvent): void {
|
||||||
if (ev.keyCode === 13) {
|
if (ev.key === "Enter") {
|
||||||
(ev.target as HTMLElement).click();
|
(ev.target as HTMLElement).click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ class StepFlowForm extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _handleKeyDown = (ev: KeyboardEvent) => {
|
private _handleKeyDown = (ev: KeyboardEvent) => {
|
||||||
if (ev.keyCode === 13) {
|
if (ev.key === "Enter") {
|
||||||
this._submitStep();
|
this._submitStep();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -324,7 +324,7 @@ export class HaVoiceCommandDialog extends LitElement {
|
|||||||
|
|
||||||
private _handleKeyUp(ev: KeyboardEvent) {
|
private _handleKeyUp(ev: KeyboardEvent) {
|
||||||
const input = ev.target as HaTextField;
|
const input = ev.target as HaTextField;
|
||||||
if (ev.keyCode === 13 && input.value) {
|
if (ev.key === "Enter" && input.value) {
|
||||||
this._processText(input.value);
|
this._processText(input.value);
|
||||||
input.value = "";
|
input.value = "";
|
||||||
this._showSendButton = false;
|
this._showSendButton = false;
|
||||||
|
@ -50,7 +50,7 @@ class OnboardingAnalytics extends LitElement {
|
|||||||
protected firstUpdated(changedProps) {
|
protected firstUpdated(changedProps) {
|
||||||
super.firstUpdated(changedProps);
|
super.firstUpdated(changedProps);
|
||||||
this.addEventListener("keypress", (ev) => {
|
this.addEventListener("keypress", (ev) => {
|
||||||
if (ev.keyCode === 13) {
|
if (ev.key === "Enter") {
|
||||||
this._save(ev);
|
this._save(ev);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -282,7 +282,7 @@ class OnboardingCoreConfig extends LitElement {
|
|||||||
100
|
100
|
||||||
);
|
);
|
||||||
this.addEventListener("keypress", (ev) => {
|
this.addEventListener("keypress", (ev) => {
|
||||||
if (ev.keyCode === 13) {
|
if (ev.key === "Enter") {
|
||||||
this._save(ev);
|
this._save(ev);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -94,7 +94,7 @@ class OnboardingCreateUser extends LitElement {
|
|||||||
setTimeout(() => this._form?.focus(), 100);
|
setTimeout(() => this._form?.focus(), 100);
|
||||||
this.addEventListener("keypress", (ev) => {
|
this.addEventListener("keypress", (ev) => {
|
||||||
if (
|
if (
|
||||||
ev.keyCode === 13 &&
|
ev.key === "Enter" &&
|
||||||
this._newUser.name &&
|
this._newUser.name &&
|
||||||
this._newUser.username &&
|
this._newUser.username &&
|
||||||
this._newUser.password &&
|
this._newUser.password &&
|
||||||
|
@ -235,7 +235,7 @@ class DialogThingtalk extends LitElement {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private _handleKeyUp(ev: KeyboardEvent) {
|
private _handleKeyUp(ev: KeyboardEvent) {
|
||||||
if (ev.keyCode === 13) {
|
if (ev.key === "Enter") {
|
||||||
this._generate();
|
this._generate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ class HaInputSelectForm extends LitElement {
|
|||||||
|
|
||||||
private _handleKeyAdd(ev: KeyboardEvent) {
|
private _handleKeyAdd(ev: KeyboardEvent) {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
if (ev.keyCode !== 13) {
|
if (ev.key !== "Enter") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._addOption();
|
this._addOption();
|
||||||
|
@ -73,7 +73,7 @@ export class DialogAddUser extends LitElement {
|
|||||||
protected firstUpdated(changedProperties: PropertyValues) {
|
protected firstUpdated(changedProperties: PropertyValues) {
|
||||||
super.firstUpdated(changedProperties);
|
super.firstUpdated(changedProperties);
|
||||||
this.addEventListener("keypress", (ev) => {
|
this.addEventListener("keypress", (ev) => {
|
||||||
if (ev.keyCode === 13) {
|
if (ev.key === "Enter") {
|
||||||
this._createUser(ev);
|
this._createUser(ev);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -296,7 +296,7 @@ export class AssistPipelineRunDebug extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _handleContinueKeyDown(ev) {
|
private _handleContinueKeyDown(ev) {
|
||||||
if (ev.keyCode === 13) {
|
if (ev.key === "Enter") {
|
||||||
this._runTextPipeline();
|
this._runTextPipeline();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ class HuiShoppingListCard
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _addKeyPress(ev): void {
|
private _addKeyPress(ev): void {
|
||||||
if (ev.keyCode === 13) {
|
if (ev.key === "Enter") {
|
||||||
this._addItem(null);
|
this._addItem(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ class HaChangePasswordCard extends LitElement {
|
|||||||
super.firstUpdated(changedProps);
|
super.firstUpdated(changedProps);
|
||||||
this.addEventListener("keypress", (ev) => {
|
this.addEventListener("keypress", (ev) => {
|
||||||
this._statusMsg = undefined;
|
this._statusMsg = undefined;
|
||||||
if (ev.keyCode === 13) {
|
if (ev.key === "Enter") {
|
||||||
this._changePassword();
|
this._changePassword();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user