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.

Submenu doesn't automatically close when an item is clicked

See original GitHub issue

I noticed that the .menubar-menu-container doesn’t automatically close when any of its .action-menu-item is clicked.

Is there a proper way for this?

I tried: $('menubar-menu-button').removeClass('open') $('.menubar-menu-container').remove()

But since it would still think that the menu is open, I’m getting new issues:

  • Hovering above the other menu items will open its submenu
  • The submenu will only open after at least 2 clicks.

Any thoughts?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

ahkohdcommented, Jul 23, 2019

Turns out, you don’t need a workaround. This worked but what the heck!

let titleBar = new Titlebar({
    backgroundColor: Color.fromHex('#ECECEC')

const menu = new Menu();
menu.append(new MenuItem({
    label: 'Item 1',
    submenu: [
            label: 'Subitem 1',
            click: () => {
                console.log('Click on subitem 1');
            type: 'separator'


Just place titlebar.updateMenu(menu); inside your click handler function, preferably at the end of the function. Weird!

jonas-johanssoncommented, Mar 28, 2020

I have this issue in 3.2.2-hotfix62 when clicking a submenu item. So clicking File -> Foo -> Bar executes the click function but the menu stays visible. Clicking File -> Cheese on the other hand executes the click function and closes the menu as expected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I close a submenu automatically by clicking on other ...
What you can do is first on click of sub-menu hide all menu inside submenu than toggle ul find more in below snippet....
Read more >
[OutSystems UI] Submenu auto close after clicking a button or ...
I wrote some Javascript in OnReady of the Menu to add class "open" to the active menu element to keep the submenu items...
Read more >
How to prevent sub-menu items from closing sub-menu?
My problem is that I can open the dropdown submenu (the “my dropdown li”'s) but when I got to click on any of...
Read more >
Submenu is closing automatically when mouse over ... - Telerik
Submenu is closing automatically when mouse over to different parent menu item in radmenu even though click to open is set to Yes....
Read more >
Control whether Menu closes on Menu.Item click #152 - GitHub
Hi there! I have a use case for the Menu component where I don't necessarily want the Menu to close when I click...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found