question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trigger the Menu to close

See original GitHub issue

Hello, great work on this library!

I’ve implemented the Menu component in a NextJS project - all working fine. I’m wondering if there is ability to close the menu without a click, say when you change a route?

If the close action can be exposed then this could be called on route change.

Thanks!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

12reactions
RobinMalfaitcommented, Oct 27, 2020

Sorry for the late answer!

I think that the Link component of Next is not forwarding all the props. Can you try to use something like this:

function NextLink(props) {
  const { href, children, ...rest } = props;
  return (
    <Link href={href}><a {...rest}>{children}</a></Link>
  )
}

You can then use it as:

<Menu.Item as={NextLink}>...</Menu.Item>
0reactions
RobinMalfaitcommented, Jul 4, 2021

@mathiassdev I think that it would be easier if you open a new issue with a minimal reproduction repository, the current behaviour (and/or errors) and the expected behaviour.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Click outside menu to close in jquery - Stack Overflow
On showing of the menu, attach a one-time click event handler on the body that closes the menu. You use jQuery's '.one()' for...
Read more >
Dropdowns · Bootstrap v5.0
Trigger dropdown menus above elements by adding .dropup to the parent element. Dropup. Action; Another action; Something else here. Separated link. Split dropup...
Read more >
Close dropdown menu - General - Forum | Webflow
In the interaction panel, click on the + button to create an element trigger. Then, select mouse hover or mouse tap depending on...
Read more >
Close mobile menu on click of outside the menu area - Divi.Help
I think the concept is listening for the user to click outside the menu, and if so, trigger a click on the hamburger...
Read more >
popup menu with colorpickedit editor -- event trigger and ...
I'd like to trigger event (and get color selected) when clicking the item in ... In both cases I'd like to close the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found