diff --git a/web/src/elements/buttons/ModalButton.ts b/web/src/elements/buttons/ModalButton.ts
index 2b4130475..46171a9e8 100644
--- a/web/src/elements/buttons/ModalButton.ts
+++ b/web/src/elements/buttons/ModalButton.ts
@@ -46,6 +46,8 @@ export class ModalButton extends LitElement {
@property({ type: Boolean })
open = false;
+ handlerBound = false;
+
static get styles(): CSSResult[] {
return [
PFBase,
@@ -64,20 +66,22 @@ export class ModalButton extends LitElement {
];
}
- firstUpdated(): void {
+ connectedCallback(): void {
+ if (this.handlerBound) return;
window.addEventListener("keyup", this.keyUpHandler);
+ this.handlerBound = true;
}
- keyUpHandler = (e: KeyboardEvent) => {
+ keyUpHandler = (e: KeyboardEvent): void => {
if (e.code === "Escape") {
this.resetForms();
this.open = false;
}
- }
+ };
disconnectedCallback(): void {
- super.disconnectedCallback()
- window.removeEventListener("keyup", this.keyUpHandler)
+ super.disconnectedCallback();
+ window.removeEventListener("keyup", this.keyUpHandler);
}
resetForms(): void {
diff --git a/web/src/pages/property-mappings/PropertyMappingScopeForm.ts b/web/src/pages/property-mappings/PropertyMappingScopeForm.ts
index f31076bd0..a7f78132d 100644
--- a/web/src/pages/property-mappings/PropertyMappingScopeForm.ts
+++ b/web/src/pages/property-mappings/PropertyMappingScopeForm.ts
@@ -58,16 +58,11 @@ export class PropertyMappingScopeForm extends ModelForm
${t`Description shown to the user when consenting. If left empty, the user won't be informed.`}