Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use key instead of keycode for key event #16625

Merged
merged 1 commit into from May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion cast/src/launcher/layout/hc-connect.ts
Expand Up @@ -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();
}
}
Expand Down
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/auth/ha-auth-flow.ts
Expand Up @@ -105,7 +105,7 @@ export class HaAuthFlow extends LitElement {
}

this.addEventListener("keypress", (ev) => {
if (ev.keyCode === 13) {
if (ev.key === "Enter") {
this._handleSubmit(ev);
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/components/ha-tab.ts
Expand Up @@ -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();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/dialogs/config-flow/step-flow-form.ts
Expand Up @@ -93,7 +93,7 @@ class StepFlowForm extends LitElement {
}

private _handleKeyDown = (ev: KeyboardEvent) => {
if (ev.keyCode === 13) {
if (ev.key === "Enter") {
this._submitStep();
}
};
Expand Down
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/onboarding/onboarding-analytics.ts
Expand Up @@ -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);
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/onboarding/onboarding-core-config.ts
Expand Up @@ -282,7 +282,7 @@ class OnboardingCoreConfig extends LitElement {
100
);
this.addEventListener("keypress", (ev) => {
if (ev.keyCode === 13) {
if (ev.key === "Enter") {
this._save(ev);
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/onboarding/onboarding-create-user.ts
Expand Up @@ -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 &&
Expand Down
2 changes: 1 addition & 1 deletion src/panels/config/automation/thingtalk/dialog-thingtalk.ts
Expand Up @@ -235,7 +235,7 @@ class DialogThingtalk extends LitElement {
};

private _handleKeyUp(ev: KeyboardEvent) {
if (ev.keyCode === 13) {
if (ev.key === "Enter") {
this._generate();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/panels/config/helpers/forms/ha-input_select-form.ts
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/panels/config/users/dialog-add-user.ts
Expand Up @@ -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);
}
});
Expand Down
Expand Up @@ -296,7 +296,7 @@ export class AssistPipelineRunDebug extends LitElement {
}

private _handleContinueKeyDown(ev) {
if (ev.keyCode === 13) {
if (ev.key === "Enter") {
this._runTextPipeline();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/panels/lovelace/cards/hui-shopping-list-card.ts
Expand Up @@ -301,7 +301,7 @@ class HuiShoppingListCard
}

private _addKeyPress(ev): void {
if (ev.keyCode === 13) {
if (ev.key === "Enter") {
this._addItem(null);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/panels/profile/ha-change-password-card.ts
Expand Up @@ -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();
}
});
Expand Down