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 }); });