Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submenu doesn't automatically close when an item is clicked #23

Closed
cruzjuniel opened this issue Mar 14, 2019 · 8 comments
Closed

Submenu doesn't automatically close when an item is clicked #23

cruzjuniel opened this issue Mar 14, 2019 · 8 comments
Labels
bug Something isn't working

Comments

@cruzjuniel
Copy link

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?

@AlexTorresDev AlexTorresDev added the bug Something isn't working label Mar 14, 2019
@amanharwara
Copy link

Has there been any progress on this issue?

@AlexTorresDev
Copy link
Owner

Has there been any progress on this issue?

No I have had time to work on this issue.

If anyone could have time to collaborate on this issue, I would appreciate it.

@sagargurtu
Copy link

Is there any workaround for this issue?

@AlexTorresDev
Copy link
Owner

I'm currently working on solving this issue.

robgonnella added a commit to robgonnella/custom-electron-titlebar that referenced this issue Jul 18, 2019
@robgonnella
Copy link
Contributor

Not sure if this is the best approach but I have a working solution here: #47

@ahkohd
Copy link

ahkohd commented 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');
                 titlebar.updateMenu(menu);
             }
        },
        {
            type: 'separator'
        }
    ]
}));

titlebar.updateMenu(menu);

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

robgonnella added a commit to robgonnella/custom-electron-titlebar that referenced this issue Jul 23, 2019
robgonnella added a commit to robgonnella/custom-electron-titlebar that referenced this issue Jul 23, 2019
@AlexTorresDev
Copy link
Owner

Resolved on #47

@jonas-johansson
Copy link

jonas-johansson commented 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants