fix (skiplink): edge case with empty folder

This commit is contained in:
MickaelK
2025-09-03 02:06:34 +10:00
parent 9e41d0c97f
commit 03a1b0f57a

View File

@ -47,7 +47,8 @@ export default WithShell(function(render) {
const $skip = createElement(`<a aria-role="navigation" href="#main">${t("Skip to content")}</a>`);
$skip.onclick = (e) => {
e.preventDefault();
assert.type(document.querySelector("main a"), window.HTMLElement).focus();
const $content = document.querySelector("main a");
if ($content) assert.type($content, HTMLElement).focus();
};
document.body.prepend($skip);
onDestroy(() => $skip.remove());