4 ms·
Why does closing the table of contents open the nav menu on mobile?
by shreddit 2y ago
Why does closing the table of contents open the nav menu on mobile?
- ZoomerCretin 2y agoOn mobile, it appears to open regardless of where you tap. This appears to be the culprit: ```const n = document.getElementById('nav-header'); document.addEventListener( 'click', s => { u.hidden || s.target === null || n === null || n.contains(s.target) || r() }``` Above, in the same function, there exists the function `e.addEventListener('click', r);`, which is likely closer to what the author intended. This fires the 'click' event any time the page is clicked, which opens the nav menu when it shouldn't.
- drewsberry 2y agoThanks for letting me know, it was a typo in the "click-away closes nav menu" logic that opened it on the first click – all fixed now.