File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -434,11 +434,14 @@ export class _MenuListState implements MenuListState {
434434 // Notify our parent
435435 if ( this . parentMenu ) this . parentMenu . openSubmenu = null ;
436436
437- if ( supportPopover ( ) && this . _element ?. popover ) this . element . hidePopover ( ) ;
437+ // If we're no longer in the DOM tree, we can bail
438+ if ( ! this . _element ?. isConnected || ! this . _element . parentElement ) return ;
439+
440+ if ( supportPopover ( ) && this . _element ?. popover ) this . _element . hidePopover ( ) ;
438441
439442 // We're going to do some focus manipulation, but we don't want parents
440443 // to react to these events (they may think the host has lost focus and
441- // react innapropriately ).
444+ // react inappropriately ).
442445 suppressFocusEvents ( ) ;
443446
444447 // Change the focus to avoid a spurious blur event
You can’t perform that action at this time.
0 commit comments