File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -263,6 +263,7 @@ class Dashboard extends DashboardLayoutMixin(
263263 let wrappers = [ ...hostElement . children ] . filter ( ( el ) => el . localName === WRAPPER_LOCAL_NAME ) ;
264264
265265 const focusedWrapper = wrappers . find ( ( wrapper ) => wrapper . querySelector ( ':focus' ) ) ;
266+ const focusedElement = focusedWrapper && focusedWrapper . querySelector ( ':focus' ) ;
266267 const focusedWrapperWillBeRemoved = focusedWrapper && ! this . __isActiveWrapper ( focusedWrapper ) ;
267268 const wrapperClosestToRemovedFocused =
268269 focusedWrapperWillBeRemoved && this . __getClosestActiveWrapper ( focusedWrapper ) ;
@@ -310,6 +311,10 @@ class Dashboard extends DashboardLayoutMixin(
310311 if ( focusedWrapperWillBeRemoved ) {
311312 // The wrapper containing the focused element was removed. Try to focus the element in the closest wrapper.
312313 this . __focusWrapperContent ( wrapperClosestToRemovedFocused || this . querySelector ( WRAPPER_LOCAL_NAME ) ) ;
314+ } else if ( focusedElement && ! focusedElement . matches ( ':focus' ) ) {
315+ // Firefox loses focus from a slotted element when the <slot> it was projected through is
316+ // removed during the shadow re-render, even after re-projection through a different slot.
317+ focusedElement . focus ( ) ;
313318 }
314319
315320 const focusedItem = this . querySelector ( ':focus' ) ;
You can’t perform that action at this time.
0 commit comments