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);