Skip to content

[Windows] Menus don't follow native keyboard conventions #2504

Closed

Description

@InPermutation

I created the Quick Start app and ran it in Windows 8.1 Professional (64-bit) with "electron-prebuilt": "^0.30.4".

Here are some ways in which using Electron menus from the keyboard don't work like Windows native menus:

  1. Pressing Alt by itself should select the first menu from the menu bar. (Electron just flashes the accelerator keys at you.)
  2. Similarly, pressing and releasing Alt then pressing a shortcut key should bring that menu up (Electron requires you to hold Alt while pressing the shortcut key, per item # 1 ).
  3. When you use the keyboard to choose a menu, the first item in the menu should be pre-selected. (Electron holds the menu open, but no item is selected.)
  4. When you have a menu selected, pressing ← or → should take you to the first item in the menu to the left/right, respectively. (Electron ignores the left and right arrow keys.)
  5. When you have a menu selected, pressing ↑ should highlight the last item in the menu. (Electron highlights the first.)

Activity

  1. changed the title [-]Menus don't follow Windows keyboard conventions[/-] [+][Windows] Menus don't follow native keyboard conventions[/+] on Aug 14, 2015
  2. felixrieseberg commented on Feb 15, 2016

    @felixrieseberg
    Member

    @kevinsawicki @zcbenz Out of curiosity: What would a good solution be for you? Would it be enough to implement the "known" Windows behavior or would you only accept changing to a truly native menu as a solution?

  3. InPermutation commented on Feb 15, 2016

    @InPermutation
    Author

    There is precedent for both—XUL famously reimplemented the entire UI framework of every platform they're on, while Qt provides a meticulous API around the native menus.

    Native menus are easier to make work with assistive technologies, etc., since they conform to the existing OS APIs. Native menus are also more likely to work with wacky configurations (custom themes, RTL languages, OS-level extensions, programmability, etc.)

    The advantage of emulating the native behavior is that it allows per-app customization using web technologies, which is the main purpose of the Electron project.

    Personally, I lean toward implementing the "known" Windows behavior, since it serves the purpose of the project better.

  4. zcbenz commented on Feb 16, 2016

    @zcbenz
    Contributor

    Using native menu would add a whole new set of menu code, considering the frequent updates of Chromium's menu code, it could be a large maintenance burden in future. So I bet on improving current implementation.

  5. zersiax commented on Mar 8, 2016

    @zersiax

    I am guessing emulating the OS-specific behavior would be better in this case. It is less of a hassle to keep up to date and I can confirm assistive technologies can work with the current menu implementation itself, as demonstrated in the VS Code project. I do think this is something that deserves attention though, I didn't even know pressing alt flashes the acelerator keys at you since I'm fully blind. I just press the accelerator keys I'm used to and hope for the best :)

  6. ahicks92 commented on Mar 18, 2016

    @ahicks92

    Are we sure that screen readers can interact with the top level of the menu? This seems like it would be hard to test without keyboard support in the first place. If they can, i.e. if arrowing is going to announce the menu names, then that's fine. Otherwise, native menus need to be considered. The alternative is going into accessibility API implementation land, and that's probably harder.
    Me and a couple other people I know are blind and would like to use Electron, but this is a pretty big deal. Menu bars need to function properly.

  7. trodick commented on Apr 14, 2016

    @trodick

    As a user of assistive technology, I feel that implementing known OS behavior is the best route. Trying to have native menus on each platform could be a maintainability nightmare.

  8. ahicks92 commented on Apr 15, 2016

    @ahicks92

    I have recently tried Visual Studio code. The good news is that the menu items are actually visible to NVDA if you know advanced features.
    I'm not saying they're usable. The process of actually getting to them was incredibly, incredibly involved. But they show up as labeled buttons so all that's needed is:

    • When alt is pressed and released, the menu bar gains focus.
    • When escape is pressed and the menu bar is focused, focus goes back to where it was before.
    • Left and right arrows move between the menus and enter and down arrow both open them.
    • The menus announce the accelerator key.

    I saw in another issue that other menus don't do this, which is true. But they do give you the first letter mnemonic. Since this menu is not actually a native menu and screen readers aren't going to do this, they need to be labeled with the key. It's not always the first letter.

  9. zersiax commented on Apr 15, 2016

    @zersiax
  10. zersiax commented on Sep 18, 2016

    @zersiax

    So ...this issue is just sitting there. Has any more thought/work been put into a fix for this?

  11. rbenson commented on Sep 27, 2016

    @rbenson

    FWIW, The way this works for Windows is that application components are revealed to the system, and exposed to MSAA. Assistive Tech grabs onto that information and does what it needs to, such as announcing it to the user, For Windows, you can use Inspect32 (if you have the Windows SDK installed) to see what roles are revealed to MSAA. Mac does it basically the same way, but not sure of the names.

    This wouldn't fix the arrow key issue.

  12. coreyfarrell commented on Oct 4, 2016

    @coreyfarrell
    1. When you use the keyboard to choose a menu, the first item in the menu should be pre-selected. (Electron holds the menu open, but no item is selected.)
    2. When you have a menu selected, pressing ← or → should take you to the first item in the menu to the left/right, respectively. (Electron ignores the left and right arrow keys.)

    I'm not sure if I should open a separate issue, items 3 and 4 are a problem for Linux too. Confirmed earlier today with latest atom.x86_64.rpm installed on Fedora 24.

  13. 12 remaining items

  14. jpluimers commented on Feb 10, 2018

    @jpluimers

    @devil418 it also hampers users not being able to use a pointing device.

  15. DanTup commented on Mar 15, 2018

    @DanTup

    This is bugging me in VS Code too. I'm used to pressing and releasing Alt before pressing a letter for a menu. Works this way in all apps I use but not Code.

    I don't care whether the implementation is native or not, as long as it behaves the same. A user shouldn't have to remember to press keys differently to do something like open the File menu.

  16. jhaslowh7 commented on Apr 27, 2018

    @jhaslowh7

    Any progress on this item?

  17. jg18 commented on Jun 29, 2018

    @jg18

    I'm interested in tackling this issue. I've been reading the Electron and Chromium docs and starting to look at the code. I use Win 10 Pro and VS 2017 with a screen reader (mostly NVDA) and screen magnifier.

    Does anyone on the team have any suggestions on where in the code to start looking for how to fix this? So far I've been looking at the files mentioned earlier by @MarshallOfSound as well as other menu-related code and working on wrapping my head around it all.

  18. ahicks92 commented on Jul 25, 2018

    @ahicks92

    Yet again Electron has come up, this time in a work-related context, and yet again I've found this issue. The Accessibility guide should be mentioning that menus have no discoverability and that users of AT may be unable to interact with menus. It's possible to guess that apps will have standard menus, but enumerating the list of available menus isn't currently possible save for the most advanced of screen reader users.

    The functionality whereby alt moves focus to the menu is how the standard discovery process works for blind users of Windows applications. It's not a screen reader provided feature. The alternative is to use NVDA's object navigation or the equivalent. Screen readers can expose the accessibility tree as an actual tree and users who know to crawl it can find them, but that's the only way to discover that there's even a menu bar in the first place. None of the common workarounds that I can think of an intermediate screen reader using (I.E. focusing the system menu with alt+space and then using the left/right arrow keys, which works in some apps) apply here.

  19. jg18 commented on Aug 9, 2018

    @jg18

    I did some research into this a few weeks ago but got kind of stuck. I'll post what I have so far.

    Starting with the source files mentioned by @MarshallOfSound:

    Possibly relevant MenuViews class that also inherits from Menu (see below for more about Views)

    The most relevant-looking files are the *View classes in Chromium's views namespace and the Electron classes (atom namespace) that inherit from them. Chromium's Views system is used on Windows and I think also Linux.

    Some potentially relevant-looking classes from Electron's views-related code (atom/browser/ui/views):

    Also potentially useful is Electron's RootView, which owns the MenuBar object and checks for whether Alt is pressed for whether to hide/show the menu.

    Chromium's FocusManager looked potentially relevant for saving/restoring focus when moving back/forth between the menu and the main window, but I'm not sure about that.

    The comments in Chromium's MenuItemView header (menu_item_view.h) look interesting:

    Note, that as menus try not to steal
    focus from the hosting window child views do not actually get focus. Instead
    |SetHotTracked| is used as the user navigates around.

    Thus SetHotTracked() may be more relevant than using Chromium's FocusManager, but I'm really not sure.

    That's all I got for now. I'll do more research/poking around the code when I can.

  20. patrickhlauke commented on Sep 4, 2018

    @patrickhlauke

    Have to admit I was surprised to encounter this issue today in an electron app, only to find out here that there's no official fix/suggested approach yet.

  21. digitaldarragh commented on Mar 4, 2019

    @digitaldarragh

    This is now working in VSCode so perhaps the issue is resolved?

  22. jakub-g commented on Mar 4, 2019

    @jakub-g

    @digitaldarragh this landed in vscode via microsoft/vscode#53924 which does the changes directly in their codebase; I don't think it's been fixed in electron yet.

  23. stuaxo commented on Mar 27, 2019

    @stuaxo

    Hi,
    This has been closed but the above comment says it is fixed for vscode not electron, can this be re-opened if it's not working in electron ?

    Cheers
    S

  24. shaicoleman commented on Jan 20, 2021

    @shaicoleman

    @ckerr , can this be reopened? Left/right keys in the menus still don't work on Linux (I've tested it on VSCode, Slack and Skype)

  25. unageek commented on Oct 9, 2021

    @unageek

    Please reopen this.

  26. gittyup2018 commented on May 12, 2023

    @gittyup2018

    I JUST tested latest version quick-start on Windows:

    We are using Node.js 18.14.0, Chromium 112.0.5615.165, and Electron 24.3.0.

    Menu navigation by arrow keys still doesn't work. Pressing alt only focuses the menu and nothing seems fixed or changed.

    I specifically updated from Node 15 to the newer version because I was under the assumption this was fixed (with the Closed tag) so it needs to be reopened and/or it needs a hack/work around that developers can manually edit at the very least.

  27. shaicoleman commented on May 12, 2023

    @shaicoleman

    Probably a new ticket needs to be opened, because there's no reply on this one

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