Skip to content

Commit 956dad7

Browse files
luwesCopilot
andauthored
fix: visually hidden focus guards (#142)
Co-authored-by: Copilot <[email protected]>
1 parent 9eacedc commit 956dad7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/html/src/components/media-popover.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,14 @@ export class MediaPopoverPortal extends HTMLElement {
378378
}
379379
}
380380

381+
const visuallyHiddenStyles = 'position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;';
382+
381383
function createFocusGuard(dataType: 'inside' | 'outside'): HTMLElement {
382384
const focusGuard = document.createElement('span');
383385
focusGuard.setAttribute('data-type', dataType);
384386
focusGuard.setAttribute('tabindex', '0');
385387
focusGuard.toggleAttribute('data-focus-guard', true);
388+
focusGuard.style.cssText = visuallyHiddenStyles;
386389
return focusGuard;
387390
}
388391

0 commit comments

Comments
 (0)