class="top-0 z-10 flex max-h-max flex-col border border-gray-400 bg-gray-50 text-zinc-700 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-50"
class="container mx-auto flex flex-row items-center justify-between border-b border-gray-400 p-2 md:border-0 dark:border-zinc-800"
class="inline-flex items-center font-medium text-indigo-700 dark:text-zinc-50"
xmlns="http://www.w3.org/2000/svg"
d="M11 21h-1l1-7H7.5c-.58 0-.57-.32-.38-.66c.19-.34.05-.08.07-.12C8.48 10.94 10.42 7.54 13 3h1l-1 7h3.5c.49 0 .56.33.47.51l-.07.15C12.96 17.55 11 21 11 21"
<span class="ml-3 text-xl">ravixUI</span>
<div class="hidden flex-row items-center md:flex md:space-x-6">
<a href="#" class="hover:text-indigo-700">About</a>
<a href="#" class="hover:text-indigo-700">Products</a>
<a href="#" class="hover:text-indigo-700">Services</a>
class="inline-flex items-center gap-x-1 rounded-lg bg-indigo-700 px-4 py-2 font-semibold text-zinc-50 hover:bg-indigo-600 disabled:pointer-events-none disabled:opacity-60"
<div class="group relative inline text-start md:hidden">
class="group/button peer inline-flex w-full justify-center rounded-md p-3 text-sm font-semibold text-gray-900 outline-offset-4 outline-black ring-gray-400 hover:bg-gray-300 focus:outline-4 aria-expanded:bg-gray-200 aria-expanded:ring lg:text-base dark:text-gray-100 dark:outline-white dark:ring-zinc-700 dark:hover:bg-zinc-700 dark:aria-expanded:bg-zinc-800"
id="navastro-menu-button-an"
<span class="sr-only">Menu Toggle</span>
xmlns="http://www.w3.org/2000/svg"
<path fill="currentColor" d="M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"
aria-orientation="vertical"
aria-labelledby="navastro-menu-button-an"
class="absolute right-0 top-14 z-10 mt-2 max-h-0 origin-top-right overflow-hidden rounded-md bg-gray-50 p-2 text-gray-800 opacity-0 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none peer-aria-expanded:max-h-96 peer-aria-expanded:opacity-100 motion-safe:transition-all motion-safe:duration-300 motion-safe:ease-in-out dark:bg-zinc-900 dark:text-gray-200"
id="navastro-dropdown-menu-an"
<li tabindex="-1" role="menuitem" id="an-navmenuastro-item-0">
class="my-1 block px-5 py-3 text-base outline-offset-4 outline-black hover:bg-gray-50 focus:outline-4 dark:outline-white dark:hover:bg-zinc-700"
<li tabindex="-1" role="menuitem" id="an-navmenuastro-item-1">
class="my-1 block px-5 py-3 text-base outline-offset-4 outline-black hover:bg-gray-50 focus:outline-4 dark:outline-white dark:hover:bg-zinc-700"
<li tabindex="-1" role="menuitem" id="an-navmenuastro-item-2">
class="my-1 block px-5 py-3 text-base outline-offset-4 outline-black hover:bg-gray-50 focus:outline-4 dark:outline-white dark:hover:bg-zinc-700"
<li tabindex="-1" role="menuitem" id="an-navmenuastro-item-3">
<form method="POST" id="an-navmenuastro-item-form-3" action="#">
class="my-1 block w-full px-5 py-3 text-start text-base outline-offset-4 outline-black hover:bg-gray-50 focus:outline-4 dark:outline-white dark:hover:bg-zinc-700"
function navMenuInitilizationAstro() {
const button = document.getElementById(
"navastro-menu-button-an",
const dropdown = document.getElementById(
"navastro-dropdown-menu-an",
const dropdownItems = dropdown?.querySelectorAll(
) as NodeListOf<HTMLLIElement>;
button?.addEventListener("click", (event) => {
if (button.getAttribute("aria-expanded") === "true") {
button.setAttribute("aria-expanded", "true");
dropdown.setAttribute("aria-hidden", "false");
* Handles keyboard navigation and interactions for a dropdown menu.
* When the dropdown is focused, the following keyboard interactions are supported:
* - Arrow Up/Down: Moves the focus to the previous/next item in the dropdown
* - Escape: Closes the dropdown
* - Enter: Clicks the currently focused dropdown item
* - Tab: Moves focus back to the button
document.documentElement.addEventListener("click", closeMenu);
dropdownItems[0].focus();
}, 200); // to prevent the focus setting from causing a stutter in the animation
dropdown.addEventListener("keydown", (keyboardEvent) => {
const e = keyboardEvent as KeyboardEvent;
if (e.key === "ArrowUp" || e.key === "ArrowDown") {
dropdownItems[tabFocus].setAttribute("tabindex", "-1");
if (e.key === "ArrowDown") {
// If we're at the end, go to the start
if (tabFocus >= dropdownItems.length) {
} else if (e.key === "ArrowUp") {
// If we're at the start, move to the end
tabFocus = dropdownItems.length - 1;
tabFocus = tabFocus % dropdownItems.length;
dropdownItems[tabFocus].focus();
} else if (e.key === "Escape") {
} else if (e.key === "Enter") {
(dropdownItems[tabFocus].children[0] as HTMLElement)?.click();
} else if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
if (e.key === "ArrowRight") {
tabFocus = dropdownItems.length - 1;
} else if (e.key === "ArrowLeft") {
tabFocus = tabFocus % dropdownItems.length;
dropdownItems[tabFocus].focus();
} else if (e.key === "Tab" || e.key === "Shift+Tab") {
const button = document.getElementById("navastro-menu-button-an");
const dropdown = document.getElementById("navastro-dropdown-menu-an");
button?.setAttribute("aria-expanded", "false");
dropdown?.setAttribute("aria-hidden", "true");
document.documentElement.removeEventListener("click", closeMenu);
document.addEventListener("astro:page-load", navMenuInitilizationAstro);