Added event listener for dismissing menu when document clicks are

received *outside* the menu body.
This commit is contained in:
Benjamin A. Shelton 2026-07-09 19:33:30 -06:00
commit c0cdce2948
Signed by: zancarius
GPG key ID: 8BD42DBD6C337E01

View file

@ -126,6 +126,14 @@ class ThemeToggler {
}
}
new ThemeToggler();
window.addEventListener("click", (event) => {
const eventPath = event.composedPath();
const isTargeted = eventPath.includes(document.getElementById("menu")) || eventPath.includes(document.getElementById("nav-menu"));
if (!isTargeted) {
document.getElementById("menu-toggle").checked = false;
}
});
</script>
</head>
<body class="flex flex-col min-h-screen">