Skip to content

Commit 8e905b7

Browse files
committed
fix: remove hoisted menu-surface from body in onDestroy
1 parent fee2755 commit 8e905b7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/menu-surface/MenuSurface.svelte

+8-1
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,15 @@
9595
if (anchor) {
9696
element && element.parentNode.classList.remove('mdc-menu-surface--anchor');
9797
}
98+
let isHoisted = false;
99+
if (menuSurface) {
100+
isHoisted = menuSurface.foundation_.isHoistedElement_;
101+
}
98102
if (instantiate !== false) {
99-
menuSurface && menuSurface.destroy()
103+
menuSurface.destroy();
104+
}
105+
if (isHoisted) {
106+
element.parentNode.removeChild(element);
100107
}
101108
});
102109

0 commit comments

Comments
 (0)