diff --git a/.changeset/honest-waves-camp.md b/.changeset/honest-waves-camp.md new file mode 100644 index 0000000000..82c4af4fa0 --- /dev/null +++ b/.changeset/honest-waves-camp.md @@ -0,0 +1,5 @@ +--- +"@nextui-org/navbar": patch +--- + +fixed NavbarMenu applying Overlay while closed diff --git a/packages/components/navbar/src/navbar-menu.tsx b/packages/components/navbar/src/navbar-menu.tsx index 48ca567cb8..382e856367 100644 --- a/packages/components/navbar/src/navbar-menu.tsx +++ b/packages/components/navbar/src/navbar-menu.tsx @@ -4,6 +4,7 @@ import {clsx, dataAttr} from "@nextui-org/shared-utils"; import {AnimatePresence, HTMLMotionProps, LazyMotion, m} from "framer-motion"; import {mergeProps} from "@react-aria/utils"; import {Overlay} from "@react-aria/overlays"; +import React from "react"; import {menuVariants} from "./navbar-menu-transitions"; import {useNavbarContext} from "./navbar-context"; @@ -31,47 +32,54 @@ const NavbarMenu = forwardRef<"ul", NavbarMenuProps>((props, ref) => { const styles = clsx(classNames?.menu, className); + // only apply overlay when menu is open + const OverlayComponent = isMenuOpen ? Overlay : React.Fragment; + const contents = disableAnimation ? ( -