From 2a38980dbeace9ed6d9288beae33a82be522c855 Mon Sep 17 00:00:00 2001 From: Fredrik Jonsson Date: Tue, 20 Aug 2024 11:55:52 +0200 Subject: [PATCH] Avoid js error when no menu items exist. --- assets/js/mobile.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/assets/js/mobile.js b/assets/js/mobile.js index 94749cd..fc18a6e 100644 --- a/assets/js/mobile.js +++ b/assets/js/mobile.js @@ -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()); + } })();