strapi / strapi-starter-next-corporate

Next.js starter for creating a corporate site with Strapi.
https://strapi-starter-next-corporate.vercel.app
MIT License
346 stars 95 forks source link

The mobile Menu Doesn't close #62

Open SudoStain opened 3 years ago

SudoStain commented 3 years ago

I'm pretty sure this is a nextjs problem but when you click on the contact page the page loads in the background but the menu doesn't close.

Screen Shot 2021-09-01 at 1 56 50 PM
catnose99 commented 3 years ago

@SudoStain Updating components/elements/mobile-nav-menu.js as below may close your issue. https://github.com/strapi/strapi-starter-next-corporate/pull/63/files

troias commented 2 years ago

const closeHandler = () => { closeSelf(); };

useEffect(() => { const routeChangeComplete = (url) => { closeHandler() } router.events.on("routeChangeComplete", routeChangeComplete) return () => { router.events.off("routeChangeComplete", routeChangeComplete) } }, [])