From cb61c082794fcdfba470407decc38d7e7b4f23ac Mon Sep 17 00:00:00 2001 From: Daniel Tang Date: Wed, 23 Jul 2025 16:48:12 -0400 Subject: [PATCH] Fix unclickable submenus on touchscreen tablet It works by cancelling the onclick URL change for the current (bold) parent menu item. This matches the mobile experience. Touchscreens can now tap a menu to go there (preserving current UX), tap again to open the submenu, then tap the submenu item. Previous behavior with mice is unchanged. --- js/menu.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/menu.js b/js/menu.js index 4b46b66641..c124f863cb 100644 --- a/js/menu.js +++ b/js/menu.js @@ -20,7 +20,10 @@ let activeDrawer // active dropdown nav link for (const el of itemsMenu) { - el.addEventListener("click", () => { + el.addEventListener("click", (e) => { + if (e.target.parentNode === el && e.pointerType === "touch" && el.querySelector("a.active")) { + e.preventDefault(); // Tapping active menu on touchscreen tablet should open menu, not click + } if (isSmallScreen || 'ontouchstart' in document.documentElement) { // HANDLE ACTIVE LINKS IN DROPDOWN NAV // if no activeDrawer set then page was set in md logic