trap focus

This commit is contained in:
seb
2026-07-19 16:47:49 +02:00
parent 9c20672e26
commit cf1d3e2880
3 changed files with 14 additions and 1 deletions

View File

@@ -9,9 +9,20 @@ import { NAV_ITEMS } from '../nav';
const SIDEBAR_WIDTH = 144;
const FOCUSABLE =
'a, button, input, textarea, select, [role="button"], [role="menuitem"], [tabindex]:not([tabindex="-1"]), [contenteditable="true"]';
function preserveFocusOnBackground(e) {
if (e.target.closest(FOCUSABLE)) return;
e.preventDefault();
}
export default function AppShell() {
return (
<Box sx={{ display: 'flex', minHeight: '100vh', bgcolor: 'background.default' }}>
<Box
onMouseDown={preserveFocusOnBackground}
sx={{ display: 'flex', minHeight: '100vh', bgcolor: 'background.default' }}
>
<Box
component="nav"
sx={(theme) => ({