Skip to content

[regression] Linux Electron after upgrade to 6.0+ always unnecessary opens BrowserWindow menu on every keyboard layout switch via Alt+Shift & Alt+Ctrl hotkeys #22213

Closed

Description

@MurzNN

Electron version: all versions after 6.0 release

Operating system: All Linux distributions with KDE environment

Expected behavior:

When user change keyboard layout via Alt+Ctrl or Alt+Shift hotkeys, it should just change keyboard layout and have no effect on any focused Electron input elements.

Actual behavior:

At every layout changing on any input element (textarea, input, etc) - it lose focus, so users can't continue typing text, and need manually click on input element to restore focus and continue typing. This is very annoying for all non-English users!

How to reproduce:

  1. Add any second keyboard layout in KDE settings, default hotkey for switch will be "Alt+Shift".

  2. Open any app, using Electron 6.0 version, for example "Quick start" app.

  3. Make focus on any input element, start typing some text.

  4. Press "Alt+Shift" and try continue typing, you will can't, because element lose focus! Via "Alt" key press Electron activates app menu, and you can press "Esc" for deactivate it and continue typing, or click via mouse on element.

How to fix:

Downgrade Electron application to 5.x or earlier versions of Electron, and this issue will not reproduced!

Please investigate source of this issue and fix this regression on fresh Electron versions!

P.S. Some Electron 4.x apps was have similar issue, that can be fixed via workaround with adding keyboard shortcuts to all menu elements (here is example of fix: element-hq/element-web#4345), but this workaround stops working on Electron 6.x+ versions.

Activity

  1. hotsezus commented on Feb 16, 2020

    @hotsezus

    Is this a regression?

  2. MurzNN commented on Feb 16, 2020

    @MurzNN
    Author

    @AlexDerbenew - yes, this is regression on Electron 6.0 release and all newer versions, because all applications, using Electron 4.x-5.x, that fixes issue #11106 via "menu shortcuts" workaround, works well with "Alt+Shift" layout switch, but broken again after upgrade dependency to Electron 6.0. So, as result, Electron 6.0 do some new change, that broke normal behavior of Alt+Shift layout switch hotkey!

  3. changed the title [-][regression] Linux Electron always unnecessary opens BrowserWindow menu on every keyboard layout switch via Alt+Shift & Alt+Ctrl hotkeys[/-] [+][regression] Linux Electron after upgrade to 6.0 always unnecessary opens BrowserWindow menu on every keyboard layout switch via Alt+Shift & Alt+Ctrl hotkeys[/+] on Feb 17, 2020
  4. changed the title [-][regression] Linux Electron after upgrade to 6.0 always unnecessary opens BrowserWindow menu on every keyboard layout switch via Alt+Shift & Alt+Ctrl hotkeys[/-] [+][regression] Linux Electron after upgrade to 6.0+ always unnecessary opens BrowserWindow menu on every keyboard layout switch via Alt+Shift & Alt+Ctrl hotkeys[/+] on Feb 20, 2020
  5. steve-todorov commented on Feb 20, 2020

    @steve-todorov

    This is really annoying issue. I am having it as well as many other people and it makes apps pretty much unusable when you have multi-language environment. It's also affecting Skype, RocketChat/Rocket.Chat.Electron#1355 and other apps which rely on newer versions of Electron.

  6. hotsezus commented on Feb 20, 2020

    @hotsezus

    This also happens with all apps made by nativefier (using electron inside)

  7. manussos commented on Mar 31, 2020

    @manussos

    Really annoying issue. Noticed it on Slack and VSCode (on Fedora 31 with KDE).
    Trying to avoid it by using Meta+Space to switch language, but changing a 25+ year old habit is hard! (Also, that's not a solution, it's a workaround)...

  8. chameleon-lizard commented on Apr 22, 2020

    @chameleon-lizard

    The focus is also stolen if you are using Alt+Space shortcut to switch language. Fix, please!

  9. deleted a comment from vetash on Apr 27, 2020
  10. jkleinsc commented on Apr 27, 2020

    @jkleinsc
    Member

    @vetash your comment was deleted as a violation of the Electron Code of Conduct. You may consider this an official warning.

    Please do not interact with the project for 24 hours. After that, please look through your open issues and edit them to ensure they're entirely on-topic, and we can continue the discussion here about the best way to go forward.

  11. Dreyk007 commented on May 8, 2020

    @Dreyk007

    Very annoying. Issue actual for every electron app (VSCode, Zulip, etc...)
    KDE Neon (Ubuntu 18.04)

  12. faerics commented on Jun 21, 2020

    @faerics

    Also influences two projects I often use:

    Quite annoying. From now, when I think of using a new app, I check if it is based on Electron or not.
    And if it is, I shall not use it.

    Please, fix it!

  13. 2 remaining items

  14. faerics commented on Jul 11, 2020

    @faerics

    Being curious, looked at the places @MurzNN pointed out.

    While reading, I found this comment somewhat strange, because afaik the menu bar should be toggled when any key is pressed with alt modifier except those which points to a submenu.

    Looking for someone to help us here! 🙏

  15. MurzNN commented on Jul 13, 2020

    @MurzNN
    Author

    @faerics thanks for pointing to right place! At first look all rules are right, but when we pressing Shift after holding Alt - code seems think that this is modifier, and catch it via this if https://github.com/electron/electron/blob/master/shell/browser/ui/views/root_view.cc#L122
    Maybe commenting this https://github.com/electron/electron/blob/master/shell/browser/ui/views/root_view.cc#L134 line can solve this issue?
    Can anybody, who can compile Electron with test app from scratch, test this?

  16. mrkeuz commented on Jul 20, 2020

    @mrkeuz

    @MurzNN ok, I don't have skills in electron, but comment pointed only for alt + modifier command, but in my case it appears even I do Ctrl + modifier. (Even system meta key set to Meta aka Super versus system default Alt, see screenshot). Of course maybe I missed something important and system meta key not affect it at all to bug. But what can I say for sure that Ctrl + modifier or other as KB layout affect this issue.

    UPD: It strange but I cannot reproduce it (even alt) on latest vscode (vscode: 1.47.1 Electron: 7.3.2) seems they made some fixes for that after 1.47.0 version. But I can build some pure electron app for testing, just give me some code and instruction how to build it. Will be glad to make some tests on my machine.

    System_meta key

  17. faerics commented on Jul 21, 2020

    @faerics

    @sofianguy Hello, we will be glad if you find a couple of minutes to answer two questions:

    • Please, provide @mrkeuz some instruction for building a small test app (just a set of links to start with should be enough I think)
    • Please, we need a person from Electron team to help with resolvong this issue asap. Could you be that person? If not, could you point out some other contributor / member to communicate with? It won't consume much time as we will try to do everithing on our own here.

    Cheers... and thank you for your help.
    Have a nice day!

  18. DanielLitvak commented on Aug 18, 2020

    @DanielLitvak

    @mrkeuz this still happens to me in vscode version 1.48

    I would like to clarify the steps to reproduce. pressing alt then shift then releasing alt first will cause the issue, the issue does not occur when releasing shift first.

  19. NemchinovSergey commented on Aug 27, 2020

    @NemchinovSergey

    The issue reproduces in Zulip v5.4.2 and Postman v7.30.1

    My workaround for Zulip

    on Linux:

    1. Close Zulip
    2. Find the Zulip's resource folder. For example: cd /opt/Zulip/resources
    3. Make backup of app.asar file
      cp app.asar app.asar.bak
    4. Unpack the app.asar archive
      npx asar extract app.asar app-unpacked
    5. Find the menu.js file and edit it, add the & symbol into the menu label
      nano ./app-unpacked/app/main/menu.js
    6. Change
    • label: t.__('File') to label: t.__('&File')
    • label: t.__('Edit') to label: t.__('&Edit')
    • And so on for each top menu items
    1. Then pack the app-unpacked folder back into asap archive
      mv app.asar app_old.asar
      npx asar pack app-unpacked app.asar
    2. Run Zulip and check Alt+Shift

    On Windows

    You can use the 7zip archiver with the asap plugin

  20. DanielLitvak commented on Aug 27, 2020

    @DanielLitvak

    @NemchinovSergey This probably won't work for versions 6+ of electron

  21. timabbott commented on Aug 27, 2020

    @timabbott

    Zulip desktop v5.4.2 is based on Electron 9.

  22. NemchinovSergey commented on Aug 28, 2020

    @NemchinovSergey

    @DanielLitvak @timabbott
    Probably you are right but I fixed it with these actions and I hope it will help someone else.

  23. vetash commented on Sep 30, 2020

    @vetash

    If you're don't need window menu at all you can remove it completely.
    0 close slack app
    1 Install python jsbeautifier over pip3, npm, npx
    sudo apt install python3-pip
    sudo pip3 install jsbeautifier
    sudo apt install npm
    sudo npm install npx -g
    2 Go to /usr/lib/slack
    cd /usr/lib/slack
    3 backup original archive
    sudo cp resources/app.asar resources/app.asar.back
    4 unpack resource pack
    sudo npx asar extract resources/app.asar unpacked_asar
    5 Make backup of main.bundle.js, make it readable with js-beautify then open with kate(or another text editor) and comment (or remove) code in function buildMenu(changedKeys) {
    sudo cp unpacked_asar/dist/main.bundle.js unpacked_asar/dist/main.bundle.js.back
    sudo js-beautify unpacked_asar/dist/main.bundle.js > /tmp/main.js
    sudo mv /tmp/main.js unpacked_asar/dist/main.bundle.js
    kate unpacked_asar/dist/main.bundle.js find buildMenu(changedKeys) { and remove\comment all between brackets {}
    6 pack resource pack back
    sudo npx asar pack unpacked_asar/ resources/app.asar
    Run slack again.

  24. electron-triage commented on Mar 10, 2021

    @electron-triage

    The Electron version reported on this issue is no longer supported. See our supported versions documentation.

    If you're still experiencing this issue on a supported version, please open a new issue with an updated repro - a Fiddle is very appreciated.

    Electron has a large issues backlog. To help our team prioritize, we're closing older issues and asking for new issues with updated repro steps if it affects a supported version. This helps sort what issues are still relevant and helps us fix them more quickly.

    Thanks for your patience and understanding!

  25. MurzNN commented on Mar 10, 2021

    @MurzNN
    Author

    Okay, if this is closed without any reasons 😠 , let's fill the new fresh one: #28088 🚀

  26. ihorch commented on May 24, 2021

    @ihorch

    I'm reproducing this right now with Debian Testing (slack-desktop 4.16 on Gnome 3.38).

  27. nohhhon commented on May 24, 2021

    @nohhhon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions