Top menu with show options V4

This commit is contained in:
Greg 2025-05-10 18:17:41 +02:00
parent 5eae0d3b2b
commit 418c2375e7
2 changed files with 13 additions and 10 deletions

View File

@ -214,12 +214,18 @@ window.onload = () => {
}
if (dropdown && dropdownContent && showMenuBtn) {
dropdown.addEventListener('mouseenter', openMenu);
dropdown.addEventListener('mouseleave', closeMenu);
showMenuBtn.addEventListener('focus', openMenu);
showMenuBtn.addEventListener('blur', closeMenu);
showMenuBtn.onclick = (e) => {
e.stopPropagation();
dropdown.classList.toggle('open');
};
// Close menu when clicking elsewhere
document.addEventListener('click', (e) => {
if (!dropdown.contains(e.target)) {
dropdown.classList.remove('open');
}
if (showAll) showAll.onclick = () => { matchViewMode = 'all'; renderTable(); closeMenu(); };
if (showFuture) showFuture.onclick = () => { matchViewMode = 'future'; renderTable(); closeMenu(); };
});
}
if (showAll) showAll.onclick = () => { matchViewMode = 'all'; renderTable(); if (dropdown) dropdown.classList.remove('open'); };
if (showFuture) showFuture.onclick = () => { matchViewMode = 'future'; renderTable(); if (dropdown) dropdown.classList.remove('open'); };
});
};

View File

@ -66,10 +66,7 @@
border-radius: 4px;
z-index: 10;
}
.menu-bar .dropdown:hover .dropdown-content,
.menu-bar .dropdown:focus-within .dropdown-content,
.menu-bar .dropdown .dropdown-content:focus,
.menu-bar .dropdown .dropdown-content:active {
.menu-bar .dropdown.open .dropdown-content {
opacity: 1;
visibility: visible;
pointer-events: auto;