Avoid js error when no menu items exist.

This commit is contained in:
Fredrik Jonsson 2024-08-20 11:55:52 +02:00
commit 2a38980dbe

View file

@ -55,7 +55,9 @@
});
// Move focus back to button efter user tab out of last link.
const lastlink = [].slice.call(links).pop();
lastlink.addEventListener('blur', () => toggle.focus());
if (links.length) {
const lastlink = [].slice.call(links).pop();
lastlink.addEventListener('blur', () => toggle.focus());
}
})();