File tree Expand file tree Collapse file tree 2 files changed +5
-31
lines changed Expand file tree Collapse file tree 2 files changed +5
-31
lines changed Original file line number Diff line number Diff line change @@ -284,10 +284,10 @@ export function isElementHiddenForAria(element: Element): boolean {
284
284
const isOptionInsideSelect = element . nodeName === 'OPTION' && ! ! element . closest ( 'select' ) ;
285
285
if ( ! isOptionInsideSelect && ! isSlot && ! isElementStyleVisibilityVisible ( element , style ) )
286
286
return true ;
287
- return belongsToDisplayNoneOrAriaHiddenOrNonSlottedOrInert ( element ) ;
287
+ return belongsToDisplayNoneOrAriaHiddenOrNonSlotted ( element ) ;
288
288
}
289
289
290
- function belongsToDisplayNoneOrAriaHiddenOrNonSlottedOrInert ( element : Element ) : boolean {
290
+ function belongsToDisplayNoneOrAriaHiddenOrNonSlotted ( element : Element ) : boolean {
291
291
let hidden = cacheIsHidden ?. get ( element ) ;
292
292
if ( hidden === undefined ) {
293
293
hidden = false ;
@@ -298,17 +298,17 @@ function belongsToDisplayNoneOrAriaHiddenOrNonSlottedOrInert(element: Element):
298
298
if ( element . parentElement && element . parentElement . shadowRoot && ! element . assignedSlot )
299
299
hidden = true ;
300
300
301
- // display:none and aria-hidden=true and inert are considered hidden for aria.
301
+ // display:none and aria-hidden=true are considered hidden for aria.
302
302
if ( ! hidden ) {
303
303
const style = getElementComputedStyle ( element ) ;
304
- hidden = ! style || style . display === 'none' || getAriaBoolean ( element . getAttribute ( 'aria-hidden' ) ) === true || element . getAttribute ( 'inert' ) !== null ;
304
+ hidden = ! style || style . display === 'none' || getAriaBoolean ( element . getAttribute ( 'aria-hidden' ) ) === true ;
305
305
}
306
306
307
307
// Check recursively.
308
308
if ( ! hidden ) {
309
309
const parent = parentElementOrShadowHost ( element ) ;
310
310
if ( parent )
311
- hidden = belongsToDisplayNoneOrAriaHiddenOrNonSlottedOrInert ( parent ) ;
311
+ hidden = belongsToDisplayNoneOrAriaHiddenOrNonSlotted ( parent ) ;
312
312
}
313
313
cacheIsHidden ?. set ( element , hidden ) ;
314
314
}
Original file line number Diff line number Diff line change @@ -564,32 +564,6 @@ test('should support search element', async ({ page }) => {
564
564
await expect . soft ( page . getByRole ( 'search' , { name : 'example' } ) ) . toBeVisible ( ) ;
565
565
} ) ;
566
566
567
- test ( 'should consider inert elements to be hidden' , async ( { page } ) => {
568
- await page . setContent ( `
569
- <div aria-hidden="true">
570
- <button type="button">First</button>
571
- </div>
572
- <div inert>
573
- <button type="button">Second</button>
574
- </div>
575
- <button type="button" inert>Third</button>
576
- ` ) ;
577
-
578
- await expect ( page . getByRole ( 'button' , { name : 'First' } ) ) . toHaveCount ( 0 ) ;
579
- await expect ( page . getByRole ( 'button' , { name : 'Second' } ) ) . toHaveCount ( 0 ) ;
580
- await expect ( page . getByRole ( 'button' , { name : 'Third' } ) ) . toHaveCount ( 0 ) ;
581
-
582
- await expect (
583
- page . getByRole ( 'button' , { name : 'First' , includeHidden : true } )
584
- ) . toHaveCount ( 1 ) ;
585
- await expect (
586
- page . getByRole ( 'button' , { name : 'Second' , includeHidden : true } )
587
- ) . toHaveCount ( 1 ) ;
588
- await expect (
589
- page . getByRole ( 'button' , { name : 'Third' , includeHidden : true } )
590
- ) . toHaveCount ( 1 ) ;
591
- } ) ;
592
-
593
567
function toArray ( x : any ) : any [ ] {
594
568
return Array . isArray ( x ) ? x : [ x ] ;
595
569
}
You can’t perform that action at this time.
0 commit comments