From 0b44fba68ca4f2d5dc90d1be822f162918da57d4 Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Sat, 5 Jun 2021 12:28:35 -0400 Subject: [PATCH] cleanup listener --- docs/resources/changelog.md | 1 + src/components/dropdown/dropdown.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/resources/changelog.md b/docs/resources/changelog.md index f50ce012e..8257b2446 100644 --- a/docs/resources/changelog.md +++ b/docs/resources/changelog.md @@ -8,6 +8,7 @@ _During the beta period, these restrictions may be relaxed in the event of a mis ## Next +- Fixed a bug in `sl-dropdown` where a `keydown` listener wasn't cleaned up properly - Fixed a bug in `sl-select` where no selection with `multiple` resulted in an incorrect value [#457](https://github.com/shoelace-style/shoelace/issues/457) - Fixed a bug in `sl-select` where `sl-change` was emitted immediately after connecting to the DOM [#458](https://github.com/shoelace-style/shoelace/issues/458) diff --git a/src/components/dropdown/dropdown.ts b/src/components/dropdown/dropdown.ts index d8a28d73f..6176dd534 100644 --- a/src/components/dropdown/dropdown.ts +++ b/src/components/dropdown/dropdown.ts @@ -392,7 +392,7 @@ export default class SlDropdown extends LitElement { this.slHide.emit(); this.panel.removeEventListener('sl-activate', this.handleMenuItemActivate); this.panel.removeEventListener('sl-select', this.handlePanelSelect); - document.addEventListener('keydown', this.handleDocumentKeyDown); + document.removeEventListener('keydown', this.handleDocumentKeyDown); document.removeEventListener('mousedown', this.handleDocumentMouseDown); await stopAnimations(this);