Remove redundant JS dropdown handler - PHP fix is sufficient

This commit is contained in:
FrankZamora
2025-11-26 23:52:05 -06:00
parent 2831cabec9
commit 32d76c4ce8

View File

@@ -311,23 +311,6 @@ document.addEventListener('DOMContentLoaded', function() {
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)
if (href && href !== '#' && href !== '' && href !== '#!') {
// On desktop (>= 992px), navigate to the link
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
});
});
// NOTE: Navbar dropdown parent links now work natively
// The PHP walker only adds data-bs-toggle="dropdown" for items without real URLs
// CSS hover handles showing dropdowns on desktop