@@ -573,6 +573,52 @@ describe('SignInStart', () => {
573573 } ) ;
574574 } ) ;
575575
576+ describe ( 'Instant password field a11y' , ( ) => {
577+ it ( 'hides the empty instant password field from the a11y tree via aria-hidden' , async ( ) => {
578+ const { wrapper } = await createFixtures ( f => {
579+ f . withEmailAddress ( ) ;
580+ f . withPassword ( { required : true } ) ;
581+ } ) ;
582+ const { container } = render ( < SignInStart /> , { wrapper } ) ;
583+
584+ const passwordField = container . querySelector ( '#password-field' ) as HTMLElement ;
585+ expect ( passwordField ) . not . toBeNull ( ) ;
586+
587+ const row = passwordField . closest ( '[class*="formFieldRow"]' ) as HTMLElement ;
588+ expect ( row ) . toHaveAttribute ( 'aria-hidden' , 'true' ) ;
589+ } ) ;
590+
591+ it ( 'reveals the instant password field when the browser autofills it' , async ( ) => {
592+ // Simulate the browser's :autofill animation that the component polls for
593+ mockGetComputedStyle . mockReturnValue ( {
594+ animationName : 'onAutoFillStart' ,
595+ pointerEvents : 'auto' ,
596+ getPropertyValue : vi . fn ( ) . mockReturnValue ( '' ) ,
597+ } ) ;
598+
599+ const { wrapper } = await createFixtures ( f => {
600+ f . withEmailAddress ( ) ;
601+ f . withPassword ( { required : true } ) ;
602+ } ) ;
603+ const { container } = render ( < SignInStart /> , { wrapper } ) ;
604+
605+ const passwordField = container . querySelector ( '#password-field' ) as HTMLElement ;
606+ const row = passwordField . closest ( '[class*="formFieldRow"]' ) as HTMLElement ;
607+
608+ // initially hidden from a11y tree until the autofill poll fires
609+ expect ( row ) . toHaveAttribute ( 'aria-hidden' , 'true' ) ;
610+
611+ await waitFor (
612+ ( ) => {
613+ expect ( row ) . not . toHaveAttribute ( 'aria-hidden' ) ;
614+ } ,
615+ { timeout : 2000 } ,
616+ ) ;
617+ // Forgot password action only renders once the field is shown
618+ screen . getByText ( / F o r g o t p a s s w o r d / i) ;
619+ } ) ;
620+ } ) ;
621+
576622 describe ( 'Session already exists error handling' , ( ) => {
577623 it ( 'redirects user when session_exists error is returned during sign-in' , async ( ) => {
578624 const { wrapper, fixtures } = await createFixtures ( f => {
0 commit comments