From c6281859fd95c7302d7021bf3c761af81e464219 Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Tue, 18 Jul 2023 12:49:22 -0400 Subject: [PATCH] remove dead logic --- src/components/button/button.ts | 13 ------------- src/components/menu-item/menu-item.ts | 13 ------------- 2 files changed, 26 deletions(-) diff --git a/src/components/button/button.ts b/src/components/button/button.ts index 0ef28a3f3e..8e5d7c3770 100644 --- a/src/components/button/button.ts +++ b/src/components/button/button.ts @@ -167,11 +167,6 @@ export default class SlButton extends ShoelaceElement implements ShoelaceFormCon return ''; } - constructor() { - super(); - this.addEventListener('click', this.handleHostClick); - } - firstUpdated() { if (this.isButton()) { this.formControlController.updateValidity(); @@ -198,14 +193,6 @@ export default class SlButton extends ShoelaceElement implements ShoelaceFormCon } } - private handleHostClick = (event: MouseEvent) => { - // Prevent the click event from being emitted when the button is disabled or loading - if (this.disabled || this.loading) { - event.preventDefault(); - event.stopImmediatePropagation(); - } - }; - private handleInvalid(event: Event) { this.formControlController.setValidity(false); this.formControlController.emitInvalidEvent(event); diff --git a/src/components/menu-item/menu-item.ts b/src/components/menu-item/menu-item.ts index ccbc8aec2c..2d95eb889d 100644 --- a/src/components/menu-item/menu-item.ts +++ b/src/components/menu-item/menu-item.ts @@ -48,11 +48,6 @@ export default class SlMenuItem extends ShoelaceElement { /** Draws the menu item in a disabled state, preventing selection. */ @property({ type: Boolean, reflect: true }) disabled = false; - constructor() { - super(); - this.addEventListener('click', this.handleHostClick); - } - private handleDefaultSlotChange() { const textLabel = this.getTextLabel(); @@ -69,14 +64,6 @@ export default class SlMenuItem extends ShoelaceElement { } } - private handleHostClick = (event: MouseEvent) => { - // Prevent the click event from being emitted when the button is disabled or loading - if (this.disabled) { - event.preventDefault(); - event.stopImmediatePropagation(); - } - }; - @watch('checked') handleCheckedChange() { // For proper accessibility, users have to use type="checkbox" to use the checked attribute