fix: visually hidden focus guards (#142)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Wesley Luyten
2025-10-27 14:59:50 -05:00
committed by GitHub
co-authored by Copilot
parent 9eacedc484
commit 956dad7ff5
@@ -378,11 +378,14 @@ export class MediaPopoverPortal extends HTMLElement {
}
}
const visuallyHiddenStyles = 'position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;';
function createFocusGuard(dataType: 'inside' | 'outside'): HTMLElement {
const focusGuard = document.createElement('span');
focusGuard.setAttribute('data-type', dataType);
focusGuard.setAttribute('tabindex', '0');
focusGuard.toggleAttribute('data-focus-guard', true);
focusGuard.style.cssText = visuallyHiddenStyles;
return focusGuard;
}