From d2d358c758a2a27b39d30c086424d12a97b5fd9c Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Tue, 18 Jun 2024 18:04:06 -0700 Subject: [PATCH] fix: focus --- src/assets/scripts/menu.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/assets/scripts/menu.js b/src/assets/scripts/menu.js index 9d4bcde8..019b45c7 100644 --- a/src/assets/scripts/menu.js +++ b/src/assets/scripts/menu.js @@ -3,7 +3,6 @@ window.addEventListener('load', () => { const menuButtonContainer = document.querySelector('.menu-button-container') const menuItems = document.querySelectorAll('.menu-primary li[role="menu-item"]') const isMobile = () => window.innerWidth <= 768 - const updateTabIndex = () => { const isExpanded = menuInput.checked menuButtonContainer.setAttribute('aria-expanded', isExpanded) @@ -13,16 +12,7 @@ window.addEventListener('load', () => { if (link) link.setAttribute('tabindex', isMobile() && !isExpanded ? '-1' : '0') }) } - - const handleMenuChange = () => { - updateTabIndex() - if (menuInput.checked) { - const firstLink = menuItems[0].querySelector('a') - if (firstLink) firstLink.focus() - } else { - menuButtonContainer.focus() - } - } + const handleMenuChange = () => updateTabIndex() updateTabIndex()