@@ -334,8 +334,8 @@ describe('combobox typing surfaces', () => {
334334 expect ( input . value ) . toBe ( 'Mondu' )
335335 } )
336336
337- it ( 'refuses mixed or unrelated blockers instead of treating them as suggestions ' , ( ) => {
338- const { option } = composeField ( )
337+ it ( 'does not treat mixed or unrelated blockers as suggestions, and types through keyboard focus ' , ( ) => {
338+ const { input , option } = composeField ( )
339339 const overlay = visible ( document . createElement ( 'div' ) )
340340 overlay . setAttribute ( 'aria-label' , 'Unrelated overlay' )
341341 document . body . append ( overlay )
@@ -344,11 +344,38 @@ describe('combobox typing surfaces', () => {
344344 value : ( x : number ) => ( x > 70 ? overlay : option ) ,
345345 } )
346346
347- expect ( focusElementForTyping ( 0 ) ) . toEqual ( {
348- error : 'obstructed' ,
349- blocker : 'Mondu' ,
350- blockerControls : [ ] ,
347+ expect ( focusElementForTyping ( 0 ) ) . toMatchObject ( {
348+ focused : true ,
349+ coveredBy : 'Mondu' ,
350+ coveredByRelatedPopup : false ,
351351 } )
352+ expect ( document . activeElement ) . toBe ( input )
353+ } )
354+
355+ it ( 'types into a top-page field a promo card covers, naming the cover' , ( ) => {
356+ document . body . innerHTML = '<input type="search" aria-label="Search" /><div>Shop for your home</div>'
357+ const input = visible ( document . querySelector ( 'input' ) as HTMLInputElement )
358+ const card = visible ( document . querySelector ( 'div' ) as HTMLDivElement )
359+ register ( input )
360+ Object . defineProperty ( document , 'elementFromPoint' , { configurable : true , value : ( ) => card } )
361+
362+ expect ( focusElementForTyping ( 0 ) ) . toMatchObject ( { focused : true , coveredBy : 'Shop for your home' } )
363+ expect ( typeIntoElement ( 0 , 'cooking pot' , false ) ) . toMatchObject ( { dispatched : true } )
364+ expect ( input . value ) . toBe ( 'cooking pot' )
365+ } )
366+
367+ it ( 'still refuses a covered field inside a frame' , ( ) => {
368+ const frame = document . createElement ( 'iframe' )
369+ document . body . append ( frame )
370+ const inner = frame . contentDocument as Document
371+ inner . body . innerHTML = '<input type="text" /><div>Cover</div>'
372+ const field = visible ( inner . querySelector ( 'input' ) as HTMLInputElement )
373+ const cover = visible ( inner . querySelector ( 'div' ) as HTMLDivElement )
374+ field . scrollIntoView = ( ) => { }
375+ register ( field )
376+ Object . defineProperty ( inner , 'elementFromPoint' , { configurable : true , value : ( ) => cover } )
377+
378+ expect ( focusElementForTyping ( 0 ) ) . toMatchObject ( { error : 'obstructed' , blocker : 'Cover' } )
352379 } )
353380
354381 it ( 'refuses ambiguous composite fields and descendant passwords' , ( ) => {
0 commit comments