@@ -62,15 +62,16 @@ describe('detached', () => {
6262 // Open detached overlay
6363 searchButton . click ( ) ;
6464
65- await waitFor ( ( ) => {
66- const input = document . querySelector < HTMLInputElement > ( '.aa-Input' ) ! ;
65+ const input = document . querySelector < HTMLInputElement > ( '.aa-Input' ) ! ;
6766
68- expect ( document . querySelector ( '.aa-DetachedOverlay' ) ) . toBeInTheDocument ( ) ;
69- expect ( document . body ) . toHaveClass ( 'aa-Detached' ) ;
70- expect ( input ) . toHaveFocus ( ) ;
67+ expect ( document . querySelector ( '.aa-DetachedOverlay' ) ) . toBeInTheDocument ( ) ;
68+ expect ( document . body ) . toHaveClass ( 'aa-Detached' ) ;
7169
72- fireEvent . input ( input , { target : { value : 'a' } } ) ;
73- } ) ;
70+ // Input should immediately be focused, to ensure the keyboard is shown on mobile
71+ expect ( input ) . toHaveFocus ( ) ;
72+
73+ // Type a query in the focused input
74+ fireEvent . input ( input , { target : { value : 'a' } } ) ;
7475
7576 // Wait for the panel to open
7677 await waitFor ( ( ) => {
@@ -391,16 +392,15 @@ describe('detached', () => {
391392 // Open detached overlay
392393 searchButton . click ( ) ;
393394
394- // Type a query in the focused input
395- await waitFor ( ( ) => {
396- const input = document . querySelector < HTMLInputElement > ( '.aa-Input' ) ! ;
395+ const input = document . querySelector < HTMLInputElement > ( '.aa-Input' ) ! ;
397396
398- expect ( document . querySelector ( '.aa-DetachedOverlay' ) ) . toBeInTheDocument ( ) ;
399- expect ( document . body ) . toHaveClass ( 'aa-Detached' ) ;
400- expect ( input ) . toHaveFocus ( ) ;
397+ expect ( document . querySelector ( '.aa-DetachedOverlay' ) ) . toBeInTheDocument ( ) ;
398+ expect ( document . body ) . toHaveClass ( 'aa-Detached' ) ;
399+ // Input should immediately be focused, to ensure the keyboard is shown on mobile
400+ expect ( input ) . toHaveFocus ( ) ;
401401
402- fireEvent . input ( input , { target : { value : 'a' } } ) ;
403- } ) ;
402+ // Type a query in the focused input
403+ fireEvent . input ( input , { target : { value : 'a' } } ) ;
404404
405405 // Wait for the panel to open
406406 await waitFor ( ( ) => {
0 commit comments