Skip to content

Commit

Permalink
Add hack for Chromium bug
Browse files Browse the repository at this point in the history
  • Loading branch information
stokesman committed Feb 19, 2025
1 parent 7601474 commit ca14a75
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/components/src/modal/aria-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,14 @@ export function unmodalize() {
for ( const element of hiddenElements ) {
element.removeAttribute( 'inert' );
}

// Hacks around a Chromium bug where it may fail to restore a region to the
// accessibility tree after an ancestor had the `inert` attribute removed.
// The bug seems like a variation of this: https://crbug.com/1354313
// This workaround doesn't have to be a custom property. It also seems to
// not have to be done each invocation but it's inexpensive and ensures
// some other code didn't remove it.
document
.querySelectorAll< HTMLElement >( '[role=region]' )
.forEach( ( region ) => region.style.setProperty( '--∞', '8' ) );
}

0 comments on commit ca14a75

Please sign in to comment.