This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 184891 - Mnemonics are not shown in context menus
Summary: Mnemonics are not shown in context menus
Alias: None
Product: platform
Classification: Unclassified
Component: Actions (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 normal (vote)
Assignee: Jaroslav Tulach
Depends on: 199317
  Show dependency tree
Reported: 2010-04-23 19:54 UTC by matthies
Modified: 2011-06-09 16:17 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

USE_MNENOMICS & changes in (9.20 KB, patch)
2011-06-07 09:05 UTC, Jaroslav Tulach
Details | Diff
Hg bundle with sample testing application (2.89 KB, application/octet-stream)
2011-06-07 09:06 UTC, Jaroslav Tulach

Note You need to log in before you can comment on or make changes to this bug.
Description matthies 2010-04-23 19:54:30 UTC
When opening a context menu ("Popup"), the accelerator keys are not underlined, unless they are opened while the Alt key is being pressed (either Alt+Right-click or after defining a new shortcut Alt+<something> for "Popup"). Another trick that works in some cases (e.g. for the editor's context menu) is to press&release Alt (so the focus moves to the main menu bar and accelerators are highlighted there) and then opening the context menu using the CONTEXT_MENU key. Note that pressing Alt while a context menu is open closes the context menu, so having Alt trigger the underlining doesn't usefully work for context menus.

Context menus should always show the accelerator keys underlined when they have been opened using the keyboard. Otherwise it's difficult to find out what the accelerator key is for a given item, or even that there are accelerator keys at all.
Comment 1 Peter Pis 2010-04-26 07:01:09 UTC
please evaluate.
Comment 2 Jaroslav Tulach 2010-04-26 08:20:44 UTC
Unless I am mistaken, there is some UI reason for not underlaying anything in popup menu. Ondřej can correct me.
Comment 3 matthies 2010-04-27 20:04:58 UTC
Sorry, but how can this be? This is a crucial accessibility issue.
How is one supposed to use the accelerator keys if they are not highlighted?
In all Windows applications I use that have context menus with accelerator keys, the keys are underlined when opening the context menu with the keyboard.
Comment 4 Jesse Glick 2011-01-28 15:32:51 UTC
I think you are referring to mnemonics, not accelerators (~ shortcuts)? If so, then I don't know about 6.8, but they are intentionally suppressed in context menus in 7.0: bug #83952.

(In reply to comment #3)
> How is one supposed to use the accelerator keys if they are not highlighted?

You're not. You can select a menu item using the arrow keys; or invoke an accelerator, where one exists.
Comment 5 matthies 2011-01-31 17:59:01 UTC
Yes, I mean mnemonics aka "access keys", sorry for the confusion.

There are the following two problems:

1) Most context menu entries don't have a mnemonic (unlike most main menu entries). Having to use the arrow keys is a real pain for keyboard users. I avoid using the mouse because of RSI, but having to use the arrow keys in context menus also strains my RSI.

2) Mnemonics are not shown underlined in context menus (unlike in main menus) when opened by keyboard, so even if a context menu entry happens to have a mnemonic there's no way to see it.

I don't understand the rationale in issue #83952 of suppressing context menu mnemonics in 7.0 completely. Can you please elaborate on this?

On Windows, there is the convention that if a menu entry has no explicit mnemonic, then the first character of the label acts as a menmonic (e.g. see the Windows Start menu). This ensures that all menu entries have mnemonics (even if they sometimes conflict). It would be great if NetBeans adopted this on its menus (and would display mnemonics underlined in context menus).

I know that those who use mnemonics in menus are in the minority, but for those who do it's an important usability (and sometimes health) issue. There's a reason why it's part of the Windows UX Guidelines [1]: "Assign access keys to all menu items so that users who prefer working with the keyboard have the same ability to navigate your program as users who work with the mouse. [...] Assign access keys to all menu items. No exceptions."

Comment 6 Jesse Glick 2011-01-31 18:56:53 UTC
(In reply to comment #5)
> I don't understand the rationale in issue #83952 of suppressing context menu
> mnemonics in 7.0 completely. Can you please elaborate on this?

There was no agreement in the discussion of that issue that mnemonics would be useful in context menus, and there was no one willing to step up to the task of reviewing every context menu in the IDE to ensure that all of its items specified a meaningful mnemonic with minimal conflicts. Rather than leave a handful of mnemonics in place in some menus, which looked very bad, it was decided to just suppress them all. You can bring it up on the mailing lists; I have no strong opinion on the matter.
Comment 7 Jaroslav Tulach 2011-06-07 09:04:27 UTC
True, NetBeans IDE does not want mnemonics in popup menu these days, but some applications built on top of NetBeans platform may want to show the mnemonics in popup menu anyway.

Here is a small branding change that provides new USE_MNENOMICS=always key API. The patch also contains changes to make sure top component's menu can have mnemonics on.
Comment 8 Jaroslav Tulach 2011-06-07 09:05:10 UTC
Created attachment 108774 [details]
USE_MNENOMICS & changes in
Comment 9 Jaroslav Tulach 2011-06-07 09:06:37 UTC
Created attachment 108775 [details]
Hg bundle with sample testing application
Comment 10 Jesse Glick 2011-06-08 13:47:58 UTC
As a tracking matter, I do not think it is good to repurpose this issue - about restoring mnemonics to context menus in the NB IDE, including (I presume) actually defining important ones where they would be missing - to something else entirely, which is defining an API for other applications to enable mnemonic display where available: implementing the API would not address any NB IDE user need. So please file a separate API review issue for the latter, probably blocking this one.