diff --git a/src/components/core/Navbar.astro b/src/components/core/Navbar.astro
index 93e1ee8..7ec4f8f 100644
--- a/src/components/core/Navbar.astro
+++ b/src/components/core/Navbar.astro
@@ -136,7 +136,7 @@ import pages from "../../data/pages.json";
-
+
{page.subpages.map((subpage) => (
div > *:not(.dropdown-container.active) {
- opacity: 0.3;
+ opacity: 0.2;
transform: scale(0.98);
- transition: all 0.3s ease;
+ filter: blur(2px);
+ transition: all 0.2s ease;
pointer-events: none;
}
#mobile-menu.has-active-dropdown .dropdown-container.active {
pointer-events: all;
+ filter: none;
+ transition: all 0.2s ease;
+ }
+
+ #mobile-menu.has-active-dropdown
+ .dropdown-container.active
+ .mobile-dropdown-content.show {
+ filter: none;
+ backdrop-filter: none;
+ background: transparent;
}
@@ -277,18 +325,21 @@ import pages from "../../data/pages.json";
// If clicking an already active dropdown, close it and restore interactions
if (isExpanded) {
- container?.classList.remove("active");
- mobileMenu?.classList.remove("has-active-dropdown");
- content?.classList.add("hidden");
+ // First close the dropdown
content?.classList.remove("show");
icon?.classList.remove("rotated");
- toggle.setAttribute("aria-expanded", "false");
+
+ // Then wait for animation to complete plus a delay before removing focus
+ setTimeout(() => {
+ container?.classList.remove("active");
+ mobileMenu?.classList.remove("has-active-dropdown");
+ toggle.setAttribute("aria-expanded", "false");
+ }, 300); // 200ms for animation + 100ms delay
return;
}
// Remove active state from all dropdowns first
document.querySelectorAll(".dropdown-container").forEach((el) => {
- el.classList.remove("active");
const dropdownContent = el.querySelector(
".mobile-dropdown-content"
);
@@ -298,24 +349,27 @@ import pages from "../../data/pages.json";
const dropdownIcon =
dropdownToggle?.querySelector(".dropdown-icon");
- dropdownContent?.classList.add("hidden");
dropdownContent?.classList.remove("show");
dropdownIcon?.classList.remove("rotated");
dropdownToggle?.setAttribute("aria-expanded", "false");
});
- mobileMenu?.classList.remove("has-active-dropdown");
- // Activate the clicked dropdown
+ // First focus the new dropdown
container?.classList.add("active");
mobileMenu?.classList.add("has-active-dropdown");
- content?.classList.remove("hidden");
- content?.classList.add("show");
- icon?.classList.add("rotated");
toggle.setAttribute("aria-expanded", "true");
+ icon?.classList.add("rotated");
+
+ // Then show the content with animation after a short delay
+ setTimeout(() => {
+ requestAnimationFrame(() => {
+ content?.classList.add("show");
+ });
+ }, 100);
});
});
- // Close menu when clicking outside
+ // Close menu when clicking outside ~ Doesnt really work at the moment
document.addEventListener("click", (e) => {
if (
!mobileMenu?.contains(e.target as Node) &&