From 14e68031ac309063ce52a279c909ca2918922620 Mon Sep 17 00:00:00 2001 From: FrankZamora Date: Wed, 26 Nov 2025 23:44:12 -0600 Subject: [PATCH] Fix: use capture phase for navbar dropdown click handler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added capture: true and stopImmediatePropagation() to ensure the click handler runs before Bootstrap's dropdown handlers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- Assets/js/main.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Assets/js/main.js b/Assets/js/main.js index f6896fbc..28a51ad9 100644 --- a/Assets/js/main.js +++ b/Assets/js/main.js @@ -314,6 +314,7 @@ window.addEventListener('scroll', updateActiveSection); // === NAVBAR DROPDOWN - Allow parent links to navigate on desktop === document.addEventListener('DOMContentLoaded', function() { document.querySelectorAll('.navbar .dropdown > .dropdown-toggle[href]').forEach(function(link) { + // Use capture phase to run before Bootstrap's handlers link.addEventListener('click', function(e) { var href = this.getAttribute('href'); // Only navigate if link has a real URL (not # or empty) @@ -322,10 +323,11 @@ document.addEventListener('DOMContentLoaded', function() { if (window.innerWidth >= 992) { e.preventDefault(); e.stopPropagation(); + e.stopImmediatePropagation(); window.location.href = href; } // On mobile, let Bootstrap handle dropdown toggle } - }); + }, true); // true = capture phase, runs before bubbling phase handlers }); });