File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ export const startFocusVisible = (rootEl?: HTMLElement): FocusVisibleUtility =>
4040 keyboardMode = false ;
4141 setFocus ( [ ] ) ;
4242 } ;
43- // Enter triggers on iOS device with physical keyboard
43+ // Enter triggers on iOS device with physical keyboard
4444 const onKeydown = ( ev : Event ) => {
4545 console . log ( 'onKeydown' , ev ) ;
4646 keyboardMode = FOCUS_KEYS . includes ( ( ev as KeyboardEvent ) . key ) ;
@@ -50,8 +50,9 @@ export const startFocusVisible = (rootEl?: HTMLElement): FocusVisibleUtility =>
5050 } ;
5151 const onFocusin = ( ev : Event ) => {
5252 console . log ( 'onFocusin' , ev ) ;
53+ let toFocus : Element [ ] = [ ] ;
5354 if ( keyboardMode && ev . composedPath !== undefined ) {
54- const toFocus = ev . composedPath ( ) . filter ( ( el : any ) => {
55+ toFocus = ev . composedPath ( ) . filter ( ( el : any ) => {
5556 // TODO(FW-2832): type
5657 if ( el . classList ) {
5758 return el . classList . contains ( ION_FOCUSABLE ) ;
@@ -60,7 +61,9 @@ export const startFocusVisible = (rootEl?: HTMLElement): FocusVisibleUtility =>
6061 } ) as Element [ ] ;
6162 setFocus ( toFocus ) ;
6263 }
63- keyboardMode = true ;
64+ if ( toFocus . length > 0 ) {
65+ keyboardMode = true ;
66+ }
6467 } ;
6568 const onFocusout = ( ) => {
6669 console . log ( 'onFocusout' ) ;
You can’t perform that action at this time.
0 commit comments