diff --git a/src/components/dropdown/dropdown.ts b/src/components/dropdown/dropdown.ts index aa5c2a40..17ff2bd2 100644 --- a/src/components/dropdown/dropdown.ts +++ b/src/components/dropdown/dropdown.ts @@ -346,8 +346,10 @@ export default class SlDropdown extends ShoelaceElement { } removeOpenListeners() { - this.panel.removeEventListener('sl-activate', this.handleMenuItemActivate); - this.panel.removeEventListener('sl-select', this.handlePanelSelect); + if (this.panel) { + this.panel.removeEventListener('sl-activate', this.handleMenuItemActivate); + this.panel.removeEventListener('sl-select', this.handlePanelSelect); + } document.removeEventListener('keydown', this.handleDocumentKeyDown); document.removeEventListener('mousedown', this.handleDocumentMouseDown); }