Avoid null dereference when removing event listeners in Dropdown (#958)

pull/980/head
bolte-17 2022-10-27 09:28:35 -04:00 zatwierdzone przez GitHub
rodzic a8de02bd53
commit 8893045bf1
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 4 dodań i 2 usunięć

Wyświetl plik

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