nextui icon indicating copy to clipboard operation
nextui copied to clipboard

[BUG] - Navbar Mobile Menu Can Not Be Opened

Open Th3Vladimir opened this issue 1 year ago • 19 comments

NextUI Version

2.6.8

Describe the bug

The mobile menu on the navbar cannot be opened. This issue is reproducible on the official documentation site.

Your Example Website or App

https://nextui.org/docs/components/navbar#with-menu

Steps to Reproduce the Bug or Issue

  1. Go to NextUI Navbar Documentation.
  2. Scroll down to With Menu section.
  3. Move the slider, until the "page" navbar displays the hamburger menu (mobile navbar).
  4. Attempt to open the navbar menu.

Expected behavior

I expected the mobile menu to open and display the links, but the menu flickers and does not stay open.

Screenshots or Videos

https://github.com/user-attachments/assets/512e8a13-b96d-4440-828d-a310f6afc0bc

Operating System Version

Windows 11, Android 14

Browser

Chrome

Th3Vladimir avatar Dec 12 '24 11:12 Th3Vladimir

From my side, it works fine but i'm using Mac + Chrome tho.

wingkwong avatar Dec 12 '24 11:12 wingkwong

I'm getting the same on Windows 11 and Chrome Version 131.0.6778.109

oliverpechey avatar Dec 12 '24 17:12 oliverpechey

Able to reproduce on Windows with Microsoft Edge.

wingkwong avatar Dec 13 '24 02:12 wingkwong

Mac And Chrome + Safari have same issue. But in mobile Safari dont have.

ngodacthien avatar Dec 16 '24 04:12 ngodacthien

I see the same BUG in their own site, and also my own... tried on Windows 10 with both Chrome and Firefox the hamburger menu doesnt open

newguy123-creator avatar Dec 16 '24 13:12 newguy123-creator

Weridly, the Pro version of this works just fine. So not sure why would the Pro version work and the regular one not...

newguy123-creator avatar Dec 18 '24 10:12 newguy123-creator

how to fix any one

amigoimmigration avatar Dec 18 '24 15:12 amigoimmigration

this appears to still not be fixed. Or at least not fully Before, the menu did not open AT ALL now, I have to click the menu 2 times before it opens

newguy123-creator avatar Jan 07 '25 07:01 newguy123-creator

@macci001 please follow up

wingkwong avatar Jan 07 '25 07:01 wingkwong

I fixed it by removing onMenuOpenChange={setIsMenuOpen} from Navbar component and adding the press event handler directly to the NavbarMenuToggle component like this:

<NavbarMenuToggle onPress={() => setIsMenuOpen(!isMenuOpen)} aria-label={isMenuOpen ? "Close menu" : "Open menu"} />

Natanael-Exe avatar Jan 13 '25 15:01 Natanael-Exe

For me it's not working even after removing onMenuOpenChange from the Navbar. :/ I tries upgrading to 2.6.14, but it still doesn't work.

vaclavkozak avatar Jan 21 '25 17:01 vaclavkozak

For me it's not working even after removing onMenuOpenChange from the Navbar. :/ I tries upgrading to 2.6.14, but it still doesn't work.

yeah fro me its still broken too after the 2 clicks, it opens with 1 click, but only if I dont resize the window. If I resize, then again it needs 2 clicks

newguy123-creator avatar Jan 22 '25 07:01 newguy123-creator

For me it's not working even after removing onMenuOpenChange from the Navbar. :/ I tries upgrading to 2.6.14, but it still doesn't work.

yeah fro me its still broken too after the 2 clicks, it opens with 1 click, but only if I dont resize the window. If I resize, then again it needs 2 clicks

Well, for me it doesn't work at all. Not even after multiple clicks. It just "twitches" on the side of the page and immediately disappears. No error in the console.

vaclavkozak avatar Jan 22 '25 08:01 vaclavkozak

any idea when a fix for this annoying issue is on the way?

newguy123-creator avatar Feb 11 '25 21:02 newguy123-creator

I fixed it by removing onMenuOpenChange={setIsMenuOpen} from Navbar component and adding the press event handler directly to the NavbarMenuToggle component like this:

<NavbarMenuToggle onPress={() => setIsMenuOpen(!isMenuOpen)} aria-label={isMenuOpen ? "Close menu" : "Open menu"} />

Same issue and fixed if using this. Thanks

dylanngph avatar Mar 15 '25 09:03 dylanngph

For me the issue was NavbarMenuToggle imported from "@heroui/react", importing using "@heroui/navbar" fixed the issue. May be helpful for someone.

codekappal avatar Mar 17 '25 17:03 codekappal

I fixed it by removing onMenuOpenChange={setIsMenuOpen} from Navbar component and adding the press event handler directly to the NavbarMenuToggle component like this: <NavbarMenuToggle onPress={() => setIsMenuOpen(!isMenuOpen)} aria-label={isMenuOpen ? "Close menu" : "Open menu"} />

Same issue and fixed if using this. Thanks

I also had this issue on my desktop computer and I was also leveraging onMenuOpenChange={setIsMenuOpen} on my Navbar component. This solution worked for me as well.

Note: Before I implemented this fix I only saw this issue if the height of my window was small enough. When the height of my browser window was big enough the collapsed menu worked fine.

Kismet333 avatar Apr 20 '25 06:04 Kismet333

I had the same issue on Windows and Edge. I suspect it's a double-capture event, perhaps detecting both touch and click events as the same.

If I open the developer tools and simulate a mobile touch, it works well. The issue also occurs on the Hero UI document page.

When I select "Desktop, no touch," sometimes it opens, and sometimes it doesn't. I also observe a flicker, as if it opens and closes immediately.

Image

MorganSnape avatar May 27 '25 01:05 MorganSnape

@macci001 any chance to fix this as it seems many people are having issues, and somehow in Pro it's reported to be working...

evereq avatar Jun 17 '25 20:06 evereq

OS: Windows Browser: Edge

Works well on my side

https://github.com/user-attachments/assets/cffdf1df-25ad-4a88-aa05-01dc75ff5c6f

Vishvsalvi avatar Jun 21 '25 05:06 Vishvsalvi

https://github.com/user-attachments/assets/5e330e67-713e-4f3f-b40f-b9cb8ee247c0

This one is from Android 14, Chrome

Vishvsalvi avatar Jun 21 '25 05:06 Vishvsalvi

Please use the latest version. If the issue still persists, kindly share a reproducible sandbox

Vishvsalvi avatar Jun 21 '25 05:06 Vishvsalvi