Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 414481

Summary: [Menu] Make MenuBar navigateable by keyboard
Product: [RT] RAP Reporter: Tim Buschtoens <tbuschto>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: dev, tbuschto
Version: 2.2   
Target Milestone: 2.2 M1   
Hardware: All   
OS: All   
Whiteboard:

Description Tim Buschtoens CLA 2013-08-06 08:31:18 EDT
In SWT/Win, a MenuBar can be navigated by arrow keys and mnemonic characters while "active". The mnemonic characters only work if none of the menus of the bar are open. (In which case the menu takes the mnemonics.) The arrow keys (left/right to change the active/open item, down/up to open) always work unless the a cascade item is active in an open menu.

The bar can be activated by pressing and releasing ALT (the mnemonic activator) without triggering a mnemonic, or by opening a Menu in the bar in any way. The bar is de-actived if ESC is pressed while no menu is open, if a push/check/radio menuItem is selected, or if the user clicks somewhere else.

RAP should imitate this behavior.
Comment 1 Tim Buschtoens CLA 2013-08-12 09:29:37 EDT
Fixed with commit ecfaab5ad28ef5c4cb9f56c6589a736e6b09bd41.

There are some minor (accepted) deviations from windows, such as ESC always closing all open menus and de-activating the menu bar, which is consistent with the existing key navigation for menus in RAP.
Comment 2 Sebastian Habenicht CLA 2013-08-26 05:23:22 EDT
(In reply to comment #1)
> Fixed with commit ecfaab5ad28ef5c4cb9f56c6589a736e6b09bd41.
> 
> There are some minor (accepted) deviations from windows, such as ESC always
> closing all open menus and de-activating the menu bar, which is consistent
> with the existing key navigation for menus in RAP.

(In reply to comment #1)
> Fixed with commit ecfaab5ad28ef5c4cb9f56c6589a736e6b09bd41.
> 
> There are some minor (accepted) deviations from windows, such as ESC always
> closing all open menus and de-activating the menu bar, which is consistent
> with the existing key navigation for menus in RAP.

Hi Tim,

I downloaded RAP 2.2 M1 (rap-2.2.0-M1-20130821-1618) to test Bug 413203. Since both topics are related I came upon this bug and would like to give some feedback on it.

BTW: I think that target milestone "2.1 M1" is a typo? I tested menu bar activation in 2.1 where it is not possible at all - so I guess this fix is part of 2.2 M1. 

You mentioned some known minor deviations from windows - I hope, the following findings are not part of thopse knows issues...

1. Horizontal arrow key navigation:
The current RWT behaviour is different from SWT: when a cascade item is active and the user browses the sub menu items with the down/up arrow keys, it is still possible in SWT to use the left/right arrow keys to switch to the next top level menu (which will open, if it is a cascading menu). 
With the current RWT implementation, the user gets stuck in the opened sub menu. The only chance to get back to the top menu level is to hit ESC and activate again or to use the mouse.

2. Selection of top level menu item with keys SWT.LF or SWT.CR does not work (this may be a finding for Bug 413203, but I hope it is okay to place it here):
When I browse the top level menu items and select an item by the mentioned keys, the selection event is fired in SWT; however, that does not work in RWT.

3. Activation of menu bar with the mnemonic activator:
Right after the test application is started activation works when I left click on the browser and than press and release the mnemonic ativator.
It does not work without the mouse click on the browser. In this case, the first menu item gains focus, but the arrow keys do not work and there is no response to mnemonic characters as well. This can be reproduced by pressing and releasing the mnemonic activator right after refreshing the application by hitting F5. 

4. Activation of menu bar after first action
Activate menu bar with mnemonic activator and select any item. After that, the mnemonic activator does not work anymore (no menu item gets focus). Same thing happens when the ESC key is pressed. This behaviour may be inconsistent as it happens most times, but not always (I did not find a pattern, though). When it happens it can be solved by hitting the system mnemonic activat (ALT) twice to temporarily pass focus to the browser's menu bar. After that, the application's menu bar activation works again

I was able to reproduce these findings with IE8, Chrome and FF (20.0.1), except for the last one which does only occur with FF. OS is Windows XP.
I used the test code that is part of the description of bug 413203.

Regards,
Sebastian
Comment 3 Tim Buschtoens CLA 2013-08-26 09:04:27 EDT
(In reply to comment #2)
> 
> BTW: I think that target milestone "2.1 M1" is a typo? 
yup

> 
> 1. Horizontal arrow key navigation
> 2. Selection of top level menu item with keys SWT.LF or SWT.CR does not work

I'm aware of those. The main purpose of this bug was to improve mnemonic support, therefore other keys have only been rudimentarily implemented.

> 3. Activation of menu bar with the mnemonic activator:
> It does not work without the mouse click on the browser. 
Did you try calling setFocus on any widget in the main shell in the EntryPoint?

> 4. Activation of menu bar after first action
I can't reproduce this. What modifier do you use for mnemonics?
Comment 4 Sebastian Habenicht CLA 2013-08-26 09:59:54 EDT
(In reply to comment #3)
> (In reply to comment #2)
> > 
> > BTW: I think that target milestone "2.1 M1" is a typo? 
> yup
> 
> > 
> > 1. Horizontal arrow key navigation
> > 2. Selection of top level menu item with keys SWT.LF or SWT.CR does not work
> 
> I'm aware of those. The main purpose of this bug was to improve mnemonic
> support, therefore other keys have only been rudimentarily implemented.
> 

Okay - is there another bug for fixing these issues? I think, users might get frustrated with the current implementation as they are probably used to work with the menu as provided in SWT.


> > 3. Activation of menu bar with the mnemonic activator:
> > It does not work without the mouse click on the browser. 
> Did you try calling setFocus on any widget in the main shell in the
> EntryPoint?

It works when a label is created (a text must be set, calling setFocus seems not to be necessary). An empty Text works as well. My test shell only had the menu set...

Something else I realized while testing this: When the mnemonics are used while a text fields has focus, the text field is updated with the characters. In SWT, the text field seems to lose focus when the mnemonic activator is pressed (although the cursor remains in the text field).

> 
> > 4. Activation of menu bar after first action
> I can't reproduce this. What modifier do you use for mnemonics?

"CTRL+ALT".
I updated to the current FF version (23.0.1) and it does not occur anymore. It seems to be something that has been handled differently in FF 20.01.

Regards,
Sebastian