@@ -84,15 +84,14 @@ export const createOverlay = <T extends HTMLIonOverlayElement>(
8484
8585const focusableQueryString =
8686 '[tabindex]:not([tabindex^="-"]), input:not([type=hidden]):not([tabindex^="-"]), textarea:not([tabindex^="-"]), button:not([tabindex^="-"]), select:not([tabindex^="-"]), .ion-focusable:not([tabindex^="-"])' ;
87- const innerFocusableQueryString = 'input:not([type=hidden]), textarea, button, select' ;
8887
8988export const focusFirstDescendant = ( ref : Element , overlay : HTMLIonOverlayElement ) => {
9089 let firstInput = ref . querySelector ( focusableQueryString ) as HTMLElement | null ;
9190
9291 const shadowRoot = firstInput ?. shadowRoot ;
9392 if ( shadowRoot ) {
9493 // If there are no inner focusable elements, just focus the host element.
95- firstInput = shadowRoot . querySelector ( innerFocusableQueryString ) || firstInput ;
94+ firstInput = shadowRoot . querySelector ( focusableQueryString ) || firstInput ;
9695 }
9796
9897 if ( firstInput ) {
@@ -112,7 +111,7 @@ const focusLastDescendant = (ref: Element, overlay: HTMLIonOverlayElement) => {
112111 const shadowRoot = lastInput ?. shadowRoot ;
113112 if ( shadowRoot ) {
114113 // If there are no inner focusable elements, just focus the host element.
115- lastInput = shadowRoot . querySelector ( innerFocusableQueryString ) || lastInput ;
114+ lastInput = shadowRoot . querySelector ( focusableQueryString ) || lastInput ;
116115 }
117116
118117 if ( lastInput ) {
@@ -460,7 +459,7 @@ const focusPreviousElementOnDismiss = async (overlayEl: any) => {
460459 const shadowRoot = previousElement ?. shadowRoot ;
461460 if ( shadowRoot ) {
462461 // If there are no inner focusable elements, just focus the host element.
463- previousElement = shadowRoot . querySelector ( innerFocusableQueryString ) || previousElement ;
462+ previousElement = shadowRoot . querySelector ( focusableQueryString ) || previousElement ;
464463 }
465464
466465 await overlayEl . onDidDismiss ( ) ;
0 commit comments