File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -267,6 +267,7 @@ class Dashboard extends DashboardLayoutMixin(
267267 let wrappers = [ ...hostElement . children ] . filter ( ( el ) => el . localName === WRAPPER_LOCAL_NAME ) ;
268268
269269 const focusedWrapper = wrappers . find ( ( wrapper ) => wrapper . querySelector ( ':focus' ) ) ;
270+ const focusedElement = focusedWrapper && focusedWrapper . querySelector ( ':focus' ) ;
270271 const focusedWrapperWillBeRemoved = focusedWrapper && ! this . __isActiveWrapper ( focusedWrapper ) ;
271272 const wrapperClosestToRemovedFocused =
272273 focusedWrapperWillBeRemoved && this . __getClosestActiveWrapper ( focusedWrapper ) ;
@@ -314,6 +315,10 @@ class Dashboard extends DashboardLayoutMixin(
314315 if ( focusedWrapperWillBeRemoved ) {
315316 // The wrapper containing the focused element was removed. Try to focus the element in the closest wrapper.
316317 this . __focusWrapperContent ( wrapperClosestToRemovedFocused || this . querySelector ( WRAPPER_LOCAL_NAME ) ) ;
318+ } else if ( focusedElement && ! focusedElement . matches ( ':focus' ) ) {
319+ // Firefox loses focus from a slotted element when the <slot> it was projected through is
320+ // removed during the shadow re-render, even after re-projection through a different slot.
321+ focusedElement . focus ( ) ;
317322 }
318323
319324 const focusedItem = this . querySelector ( ':focus' ) ;
You can’t perform that action at this time.
0 commit comments