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.

Menu opens whenever I click any link anywhere

See original GitHub issue

There was an issue #91, which unfortunately was promptly closed by the author without providing much explanation. Now I’m hitting the same issue and I have no idea what’s wrong.

const burgerMenu = <Menu
          isOpen={isSidebarOpen}
          customBurgerIcon={false}
          customCrossIcon={false}
        >

I open the menu by invoking this:

      openMenu = () => {
        this.setState({
          isSidebarOpen: true,
        });
      }

and rely on clicking on overlay for closing it.

The problem is every time I click on a link anywhere it triggers opening the menu. Has anyone seen this behaviour?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
denisftwcommented, Jul 4, 2018

@t-sean Indeed! Thanks a lot for your suggestion; this solves my issue. Basically, I needed onStateChange to update my internal state after clicking on the overlay. If I don’t do that then the state remains open. In this case, clicking the Link triggers componentWillReceiveProps on the Menu, and since isOpen is wrong at this point, the Menu shows up.

2reactions
t-seancommented, May 10, 2018

I saw something similar while handling my own isOpen state. Clicking out of overlay, or pressing escape would change the internal state of burger-menu, but obviously not update my own isOpen state. So if i closed the menu one of those ways, my state was still set to open, and a re-render from prop changes would cause the state check to open the menu.

This would also cause what seemed like having to double click my open/close icon, the first click updating my open state to false, then the setting it to open.

Adding the onStateChange handler to my app kept them both in synch.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Whenever I click on any link or sometimes just a ... - Quora
If you're using Google Chrome: launch the browser → press 3 dots on the top right corner → Settings → Privacy and Security...
Read more >
get menus popping up every time I click o… - Apple Community
Today I was working with an online grocery store and suddenly, no matter where I clicked, a menu would open listing various options....
Read more >
The menu opens / closes when I click anywhere on the page
I want to link the isOpen={ toggleMenu } to a custom button with an onClick and have that be the only way to...
Read more >
How to stop Chrome from opening new tabs for every link
In the drop-down menu, just click on Search settings. On the following page, scroll down towards the bottom to the 'Where results open'...
Read more >
Every time I click a link to open it, it makes a new tab. How do I ...
Go to Chrome Settings . . . Advanced . . . (or you can enter chrome://settings/reset into the omnibox as a direct way...
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