You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature Request]: Disable alt-key menu bar focus globally as user #34211
I agree to follow the Code of Conduct that this project adheres to.
I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Problem Description
Hi,
I'm on Linux desktop and assign various shortcuts with alt key. Electron uses the alt key to focus on the menu bar and I don't use the menu bar that much (if at all) to find it useful, this inteferes with Electron apps whenever I use the shortcut (mainly toggle the menu bar). Aside from shorcuts, on GNOME there's the alt+click to drag windows which also trigger the menu bar every time.
The alt key is a very convenient one and I would prefer it much for my shortcuts over the menu bar which I rarely use. I know there's already a fix #12167 but I still have that problem sometimes, for example I use a shortcut <alt+F3> in vscode that focus the menu bar everytime, I ended up using the custom menu bar to disable that behaviour, but other Electron apps don't have that.
Would it be possible to allow users to disable the key globally, similar to GTK with gtk-auto-mnemonics=0 ?
Proposed Solution
Allow users of Electron apps to disable alt key focus menu bar behaviour
Alternatives Considered
Not sure
Additional Information
No response
Reacted by William Lim, Vladimir Vasilev, Saul Fautley, Alexander Kuzmovych, Pavel Pereslegin, Itay Flikier, cycloss, Sebastian Wojtczak, Hao Tran, Sergey M and 35 more
Reacted by Vladimir Skubriev and BrensNina
Reacted by Vladimir Skubriev, Victor and BrensNina
I tend to press Alt a lot, sometimes for no reason. Since Electron started focusing the menu bar when Alt is pressed, it's made using Electron apps a nightmare for me because editors and textboxes get defocused.
PLEASE give us some way to disable this functionality. Literally no other desktop apps do this, so I don't understand why it's even a thing.
Reacted by William Lim, Akshay Pethani, Itay Flikier, Sebastian Wojtczak, Talos, endrx, Vladimir Skubriev, Alex Pedro, Brian Mack, Issytia and 21 more
Reacted by Vladimir Skubriev, shevictory and Amir Savand
@slightlyfaulty You can just have a system where it is enabled/disabled (can be toggled). I am not sure what the original intention of the new alt functionality was. This has been an issue for a long time now. It could maybe be the case that there was a change in the operating systems but if I remember correctly (this may not be the case) this issue occurs in Ubuntu as well as Windows.
Well I just found out it can be disabled in VS Code with the window.customMenuBarAltFocus and window.enableMenuBarMnemonics settings. I also had to change window.menuBarVisibility for these settings to work on Linux. At least this covers one of the Electron apps I use.
Reacted by William Lim, Gabriel Ochsenhofer, Simon Kågström, Sebastian Wojtczak, Meow, endrx, Evan Arlian, Issytia, sirok, Nick Grosenbacher and 4 more
I'm joining the request 🙏 I'm used to use alt+space for changing leyboard layout and half of the times the language doesn't change and instead I lose the focus to the menu bar...
Same problem here. I use Alt+Backspace to undo (as is common in Windows) and Alt+ArrowUp/Down to move lines in VSCode. It seems like when I press the Alt key long enough, it doesn't trigger the menu bar. But when I'm working quicker and only hold the Alt key for a short period of time, I always end up losing the text focus and the menu bar jumps in and interrupts me. Very annoying! I really hope there can be a fix for this.
After all, it should be very simple. Press the Alt key and release it, then focus the menu bar, as every other Windows application does. But press the Alt key and then press any other key before releasing Alt, then it's not for you, dear menu bar! That part is missing and the menu bar still thinks I wanted to talk to it, but missed that I was typing something else in between.
From this perspective, I don't consider this an enhancement but rather a bug.
For i18n reasons, as a person who is using a dual-layout for the greek language (as eveyone who is using the greek language), the keyboard shortcut to change the layout is (almost always) [ALT]-[SHIFT].
If I press ALT, then SHIFT, then release SHIFT, then ALT, everything is OK. If (since most of the times I am too fast typing), I first release ALT and then SHIFT, then the focus goes on the menu bar, and everything I am writing afterwards is lost :(
And btw this is a problem that a lot of my fellow greek users are also having 😭
There's a similar (closed) issue with the same problem here: #28088
this is a problem with all my used electron apps: vscode and logseq.
My native language doesn't use latin characters and I often switch keyboard layouts with alt+shift and losing focus makes typing a nightmare
If I press ALT, then SHIFT, then release SHIFT, then ALT, everything is OK. If (since most of the times I am too fast typing), I first release ALT and then SHIFT, then the focus goes on the menu bar, and everything I am writing afterwards is lost :(
That's an interesting observation. I can confirm that behaviour. And it probably explains why I see it sometimes, and sometimes not, but always for quick typing where I might release the two keys in a random order. Maybe I can try to watch out for this and train myself to avoid the issue by typing "more carefully" (hold the Alt key for longer). ;-)
And hopefully, this observation helps resolve the bug eventually. If anybody is interested in solving it. I haven't seen a project developer in this issue yet, or at least didn't recognise one by their comment. I'm not sure if this project is maintained at all! Unfortunately, VSCode relies on it.
after change settings, perhaps need to reload the window: Ctrl+Shift+P and select Developer: Reload window
but there is no solution for logseq
Reacted by WebDevManuel, cycloss, CDeLeon94, Julia, Kazuyuki TAKEMOTO, Văn Viết Hiếu Anh, shevictory, Shuhei Hayashibara, pythoninthegrass, yourock1988 and 1 more
I don't consider the custom titlebar a workaround or even a solution. It's a whole new problem. For example, it won't indicate whether the window is active and receives keyboard input or not. Native title bars do that (if you activate the option in the Windows settings, just like it has always been until Windows 7, before Microsoft decided that keyboards are useless).
@ygoe No xmodmap is Linux only. However this isn't a very good workaround since it's basically rebinding your Alt key to Right-Ctrl for your entire system. It also only works for older Linux systems running X11 and not Wayland.
Exactly, as mentioned above, this solution is only for Linux & legacy X11. It's definitely not perfect, but it's working and allowing me to work with Electron apps. Unfortunately, I can't find better workaround for this problem.
// Prevent alt-key default if the menu is not hidden and we use alt to focusif(modifierKeyStatus.event&&this.shouldAltKeyFocus){if(ScanCodeUtils.toEnum(modifierKeyStatus.event.code)===ScanCode.AltLeft){modifierKeyStatus.event.preventDefault();}}// Alt key pressed while menu is focused. This should return focus away from the menubarif(this.isFocused&&modifierKeyStatus.lastKeyPressed==='alt'&&modifierKeyStatus.altKey){this.setUnfocusedState();this.mnemonicsInUse=false;this.awaitingAltRelease=true;}
Alt menu focus regularly interferes with Alt+Shift keyboard layout switching and with custom keyboard shortcuts. And I never use Alt menu shortcuts, so this feature is completely useless for me. It annoys me for a long time, and in most apps you can't disable it. I tried many workarounds including AutoHotkey, but they usually lead to other issues
Since this issue has been completely ignored for 3.5 years, I don't hope much that it ever gets fixed
I agree with the points raised above. The inability to disable this behaviour significantly impacts my daily workflow. Surprisingly, a problem affecting so many users who rely on multiple keyboard layouts and are accustomed to switching with Alt + Shift is still overlooked. And that’s without even mentioning the other hotkeys that are affected.
Reacted by Yves Goergen, Mario Peshev, Konstantinos Papagiannopoulos and Victor
Interestingly, this should already work, but it doesn't. I don't understand the code enough to explain why.
My background is, I'm coming from this issue in VSCode. It's about the menu being focused when pressing any key combination with the Alt modifier and releasing the Alt key sooner than after a second or so. That issue was closed and I was referred to here as they could do nothing about it.
So I'm here and asked Copilot where the code is. (Crazy modern times.) The answer was this file, specifically the RootView::HandleKeyEvent method. In these lines, I see that
pressing the Alt key is remembered
releasing the Alt key (if pressed before) focuses the menu bar
but here's the interesting part: pressing any other key in between clears the pressed flag (highlighted line from the link above).
So Pressing Alt+Up or Alt+Left at any speed should never focus the menu bar. But it clearly does, at least in the VSCode application.
What's wrong? Is that code not working as intended? Is it too new and not included in VSCode yet? Has VSCode modified that part of the code and shipped something else than this original? (Then it would be their issue indeed.)
As a multilingual user, confirming this bug here. I swap between languages on Slack several times PER PARAGRAPH so the time waste is massive due to the lingo across languages.
It either needs a command line argument to launch Slack's Electron without this or a setting to invoke the menu with Alt + a specific letter to kick in (or another creative solution)
Reacted by Konstantinos Papagiannopoulos, Artem Nova, Konstantin Kovshenin, Vaz, Victor, paneverka, 74k35h1 k4n3k0 and Nika Krasnova
I also use Alt+Shift to switch keyboard layout, and as soon as I switch it, the focus immediately moves to menu. I went gray while trying to fix my Ubuntu, until I realized this is Electron. For the sake of humanity, fix it 😭
Reacted by Mario Peshev, MahouShoujoMivutilde, Strubbelkopp and Nika Krasnova
I’d also appreciate a user-configurable way to disable menu focus on Alt.
On Ubuntu 26.04.1 with GNOME and Wayland, I use Alt+Shift to switch keyboard layouts. In ChatGPT/Codex and Element Desktop, the application menu sometimes takes focus after I switch. Occasionally, I can type several characters before the menu suddenly opens.
I don’t use the menu keyboard shortcuts, so an option to disable Alt menu activation would be a useful workaround while keeping Alt+Shift for layout switching.
Activity
scorchedegg commentedon Jul 12, 2022
I tend to press
Alta lot, sometimes for no reason. Since Electron started focusing the menu bar whenAltis pressed, it's made using Electron apps a nightmare for me because editors and textboxes get defocused.PLEASE give us some way to disable this functionality. Literally no other desktop apps do this, so I don't understand why it's even a thing.
wlwl2 commentedon Jul 12, 2022
@slightlyfaulty You can just have a system where it is enabled/disabled (can be toggled). I am not sure what the original intention of the new alt functionality was. This has been an issue for a long time now. It could maybe be the case that there was a change in the operating systems but if I remember correctly (this may not be the case) this issue occurs in Ubuntu as well as Windows.
scorchedegg commentedon Jul 12, 2022
Well I just found out it can be disabled in VS Code with the
window.customMenuBarAltFocusandwindow.enableMenuBarMnemonicssettings. I also had to changewindow.menuBarVisibilityfor these settings to work on Linux. At least this covers one of the Electron apps I use.flikier commentedon Nov 1, 2022
I'm joining the request 🙏 I'm used to use alt+space for changing leyboard layout and half of the times the language doesn't change and instead I lose the focus to the menu bar...
matheus-santana1 commentedon Jan 9, 2023
tente isso...
win.removeMenu()
ygoe commentedon Feb 5, 2023
Same problem here. I use Alt+Backspace to undo (as is common in Windows) and Alt+ArrowUp/Down to move lines in VSCode. It seems like when I press the Alt key long enough, it doesn't trigger the menu bar. But when I'm working quicker and only hold the Alt key for a short period of time, I always end up losing the text focus and the menu bar jumps in and interrupts me. Very annoying! I really hope there can be a fix for this.
After all, it should be very simple. Press the Alt key and release it, then focus the menu bar, as every other Windows application does. But press the Alt key and then press any other key before releasing Alt, then it's not for you, dear menu bar! That part is missing and the menu bar still thinks I wanted to talk to it, but missed that I was typing something else in between.
From this perspective, I don't consider this an enhancement but rather a bug.
teras commentedon Feb 19, 2023
For i18n reasons, as a person who is using a dual-layout for the greek language (as eveyone who is using the greek language), the keyboard shortcut to change the layout is (almost always) [ALT]-[SHIFT].
If I press ALT, then SHIFT, then release SHIFT, then ALT, everything is OK. If (since most of the times I am too fast typing), I first release ALT and then SHIFT, then the focus goes on the menu bar, and everything I am writing afterwards is lost :(
And btw this is a problem that a lot of my fellow greek users are also having 😭
There's a similar (closed) issue with the same problem here: #28088
thanosk commentedon Feb 20, 2023
Another Greek here joining the request 🙏
I'm having this problem when using Electron Mattermost client on Linux Desktop (no matter the distro/desktop environment combination).
msergein commentedon Feb 23, 2023
this is a problem with all my used electron apps: vscode and logseq.
My native language doesn't use latin characters and I often switch keyboard layouts with
alt+shiftand losing focus makes typing a nightmareOS: Linux, Fedora Linux 37 (Workstation Edition)
ygoe commentedon Feb 23, 2023
That's an interesting observation. I can confirm that behaviour. And it probably explains why I see it sometimes, and sometimes not, but always for quick typing where I might release the two keys in a random order. Maybe I can try to watch out for this and train myself to avoid the issue by typing "more carefully" (hold the Alt key for longer). ;-)
And hopefully, this observation helps resolve the bug eventually. If anybody is interested in solving it. I haven't seen a project developer in this issue yet, or at least didn't recognise one by their comment. I'm not sure if this project is maintained at all! Unfortunately, VSCode relies on it.
msergein commentedon Feb 24, 2023
for vs code found a workaround
set settings
after change settings, perhaps need to reload the window:
Ctrl+Shift+Pand selectDeveloper: Reload windowbut there is no solution for logseq
ygoe commentedon Feb 24, 2023
I don't consider the custom titlebar a workaround or even a solution. It's a whole new problem. For example, it won't indicate whether the window is active and receives keyboard input or not. Native title bars do that (if you activate the option in the Windows settings, just like it has always been until Windows 7, before Microsoft decided that keyboards are useless).
WebDevManuel commentedon Apr 9, 2023
thank you, this has helped me a lot and works well.
msergein commentedon May 13, 2023
this issue is a year old, do you plan to do something? thanks
5 remaining items
ygoe commentedon Oct 6, 2023
@swork9 What is xmodmap? Is that available on Windows?
scorchedegg commentedon Oct 6, 2023
@ygoe No
xmodmapis Linux only. However this isn't a very good workaround since it's basically rebinding your Alt key to Right-Ctrl for your entire system. It also only works for older Linux systems running X11 and not Wayland.swork9 commentedon Oct 6, 2023
Exactly, as mentioned above, this solution is only for Linux & legacy X11. It's definitely not perfect, but it's working and allowing me to work with Electron apps. Unfortunately, I can't find better workaround for this problem.
n-r-w commentedon May 20, 2024
Still no solution found? It gets annoying, for example, when working in RocketChat using wayland
azizsayfiddin commentedon Aug 8, 2024
Same issue.
mifi commentedon Oct 5, 2024
Looks like this is what vscode is doing too:
https://github.com/microsoft/vscode/blob/51cfc9ece448a8aa328b22f33b012417ebf10a69/src/vs/base/browser/ui/menu/menubar.ts#L931
https://github.com/microsoft/vscode/blob/51cfc9ece448a8aa328b22f33b012417ebf10a69/src/vs/base/browser/dom.ts#L1993
altq33 commentedon Feb 11, 2025
this work for me, ,but it disables update ctrl+r and devtools
pythoninthegrass commentedon Apr 9, 2025
@msergein's workaround got vscode on linux (gnome shell) working as expected.
Only slight correction in
settings.jsonis the missing commas:artemgur commentedon Oct 27, 2025
Alt menu focus regularly interferes with Alt+Shift keyboard layout switching and with custom keyboard shortcuts. And I never use Alt menu shortcuts, so this feature is completely useless for me. It annoys me for a long time, and in most apps you can't disable it. I tried many workarounds including AutoHotkey, but they usually lead to other issues
Since this issue has been completely ignored for 3.5 years, I don't hope much that it ever gets fixed
vplytus commentedon Nov 29, 2025
I agree with the points raised above. The inability to disable this behaviour significantly impacts my daily workflow. Surprisingly, a problem affecting so many users who rely on multiple keyboard layouts and are accustomed to switching with Alt + Shift is still overlooked. And that’s without even mentioning the other hotkeys that are affected.
ygoe commentedon Nov 29, 2025
Interestingly, this should already work, but it doesn't. I don't understand the code enough to explain why.
My background is, I'm coming from this issue in VSCode. It's about the menu being focused when pressing any key combination with the Alt modifier and releasing the Alt key sooner than after a second or so. That issue was closed and I was referred to here as they could do nothing about it.
So I'm here and asked Copilot where the code is. (Crazy modern times.) The answer was this file, specifically the RootView::HandleKeyEvent method. In these lines, I see that
So Pressing Alt+Up or Alt+Left at any speed should never focus the menu bar. But it clearly does, at least in the VSCode application.
What's wrong? Is that code not working as intended? Is it too new and not included in VSCode yet? Has VSCode modified that part of the code and shipped something else than this original? (Then it would be their issue indeed.)
Please advise.
mpeshev commentedon Dec 11, 2025
As a multilingual user, confirming this bug here. I swap between languages on Slack several times PER PARAGRAPH so the time waste is massive due to the lingo across languages.
It either needs a command line argument to launch Slack's Electron without this or a setting to invoke the menu with Alt + a specific letter to kick in (or another creative solution)
tosiara commentedon Sep 24, 2026
I also use Alt+Shift to switch keyboard layout, and as soon as I switch it, the focus immediately moves to menu. I went gray while trying to fix my Ubuntu, until I realized this is Electron. For the sake of humanity, fix it 😭
kirmak81-spec commentedon Nov 4, 2026
I’d also appreciate a user-configurable way to disable menu focus on Alt.
On Ubuntu 26.04.1 with GNOME and Wayland, I use Alt+Shift to switch keyboard layouts. In ChatGPT/Codex and Element Desktop, the application menu sometimes takes focus after I switch. Occasionally, I can type several characters before the menu suddenly opens.
I don’t use the menu keyboard shortcuts, so an option to disable Alt menu activation would be a useful workaround while keeping Alt+Shift for layout switching.