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

Regression: Invisible menu items no longer work via their accelerator keys #12025

Closed
stephenmartindale opened this issue Feb 23, 2018 · 7 comments
Assignees
Labels
2-0-x bug 🪲 bug/regression ↩️ A new version of Electron broke something

Comments

@stephenmartindale
Copy link

With Electron 1.8, it was possible to create an invisible menu item in the application menu and, assuming it was still enabled, it could be invoked via its accelerator key. This provided a mechanism for creating application-wide shortcut keys that were independent from content.

For example, this menu-item template worked just fine:

            {
                visible: false,
                accelerator: "F12",
                click: () => {
                    mainWindow.webContents.openDevTools({ mode: "detach" });
                }
            },

Since upgrading to Electron2.0.0-beta.1, this no longer works. Instead, I have to make the menu item visible and give it a name in order for it to be triggered by its accelerator key:

            {
                visible: true,
                label: "Developer Tools",
                accelerator: "F12",
                click: () => {
                    mainWindow.webContents.openDevTools({ mode: "detach" });
                }
            },

Is this just a regression or is this by design? If it is by design, is there any way to achieve window-level shortcut keys without resorting to nasty keydown and keyup handlers on the content level?

@welcome
Copy link

welcome bot commented Feb 23, 2018

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

@codebytere
Copy link
Member

@stephenmartindale what platform was this on?

@stephenmartindale
Copy link
Author

stephenmartindale commented Apr 1, 2018 via email

@abnerlee
Copy link

abnerlee commented Apr 3, 2018

I can also reproduce this on Windows

@stephenmartindale
Copy link
Author

FYI: I tested this on 2.0.0-beta.8, today, on Windows 10, and the bug is still present.

@codebytere
Copy link
Member

i can take a look at this next week!

@codebytere codebytere self-assigned this Apr 27, 2018
@codebytere
Copy link
Member

codebytere commented May 3, 2018

@stephenmartindale verdict is that this happened as a result of some separator filtering i implemented; i'll see if i can open a PR to remedy this side effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2-0-x bug 🪲 bug/regression ↩️ A new version of Electron broke something
Projects
None yet
Development

No branches or pull requests

4 participants