@@ -62,15 +62,16 @@ describe('detached', () => {
62
62
// Open detached overlay
63
63
searchButton . click ( ) ;
64
64
65
- await waitFor ( ( ) => {
66
- const input = document . querySelector < HTMLInputElement > ( '.aa-Input' ) ! ;
65
+ const input = document . querySelector < HTMLInputElement > ( '.aa-Input' ) ! ;
67
66
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' ) ;
71
69
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' } } ) ;
74
75
75
76
// Wait for the panel to open
76
77
await waitFor ( ( ) => {
@@ -391,16 +392,15 @@ describe('detached', () => {
391
392
// Open detached overlay
392
393
searchButton . click ( ) ;
393
394
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' ) ! ;
397
396
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 ( ) ;
401
401
402
- fireEvent . input ( input , { target : { value : 'a' } } ) ;
403
- } ) ;
402
+ // Type a query in the focused input
403
+ fireEvent . input ( input , { target : { value : 'a' } } ) ;
404
404
405
405
// Wait for the panel to open
406
406
await waitFor ( ( ) => {
0 commit comments