Skip to content

[BUG]: Mobile Menu Remains Open After Navigation #33

@sach2004

Description

@sach2004

Current Behavior

The mobile navigation menu stays open after clicking a link, blocking content on the new page. Users must manually close the menu using the X button.

Steps to Reproduce

  1. Open the site on mobile (or resize browser to <1024px)
  2. Click the hamburger menu to open navigation
  3. Click any link (e.g., "Protocols" or "Research")
  4. Observe the menu remains open on the new page

Expected Behavior

The mobile menu should automatically close when navigating to a new page, matching standard mobile UX patterns.

Root Cause

The isOpen state in components/header.tsx persists across client-side route changes because Next.js doesn't unmount the Header component during navigation. The component needs to listen to route changes via the usePathname() hook (already imported) to reset the menu state.

Impact

  • Poor mobile user experience
  • Navigation requires two taps instead of one
  • Content is hidden behind the menu overlay

Proposed Solution

Add a useEffect hook that listens to pathname changes and automatically closes the menu. This follows React best practices for syncing component state with external changes.

Files Affected

  • components/header.tsx

@Zahnentferner could you please assign this issue to me??

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions