Unable to close menu after clicking on link
See original GitHub issueI’m using the menu within a “body” component that spans my whole page. I’ve added the menu as follows and I’m using react router.
var Example = React.createClass({
showSettings: function(event) {
event.preventDefault();
},
render: function() {
return (
<Menu right>
<RadiumLink className="menu-item" to="/">Home</RadiumLink>
<RadiumLink className="menu-item" to="/about">About</RadiumLink>
<RadiumLink className="menu-item" to="/contact">Portfolio</RadiumLink>
<RadiumLink className="menu-item" to="/contact">Contact</RadiumLink>
</Menu>
);
}
});
and this is its parent
render: function() {
return (
<div className="border" ref="frame">
<Example />
</div>
);
If I click on a link, it loads the page just fine however, the menu remains open and I have to either use the close button or click outside the menu to close it. How can I get it to auto-close?
Thank you
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:14 (5 by maintainers)
Top Results From Across the Web
Menu doesn't close after clicking link - Forum | Webflow
A solution is to add an interaction onto each link in the navbar to move the navmenu element 100% to the right. This...
Read more >I can't close menu when click - Stack Overflow
Try to hide/show your navigation bar using css class, that will be easy and effective way to manage it. Also replace $(document).mouseup with...
Read more >Close menu after click | WordPress.org
It's working fine for me. I have a question regarding the menu. Nowadays it is common to add an anchor link in the...
Read more >Solved: Close mobile side menu on click (anchor link)
To fix this problem you can add add the following code at the bottom of your assets/theme.js file. $(function () ...
Read more >In Praise of the Unambiguous Click Menu - CSS-Tricks
When visitors need more time to take in the submenu contents, they can't afford to have the menu close unexpectedly. The JavaScript is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I was also able to achieve that clicking an item will close the menu simply by using
isOpen={false}
! Thank you! However, I tried hooking the component through Redux using theconnect()
function and for some reason this behaviour stopped working…I have exactly the same issue with @giladbr (I’m also using redux) and I’m on version
1.10.4
. I’ve setisOpen={ false }
but when I click on a link the menu does not close. Any ideas?