SYNOPSIS
--------
JMenuBar should not be focusable by default
OPERATING SYSTEM
----------------
All
FULL JDK VERSION
----------------
All
DESCRIPTION from LICENSEE
-------------------------
JMenuBar instances are focusable by default. This can prevent keyboard focus traversal when the application contains a JMenuBar.
The attached testcase demonstrates the problem. Focus moves to the JMenuBar after the JTree. and it's there is cannot be moved anywhere else, because the focus traversal keys are disabled in the JMenuBar (despite the fact that it is focusable).
As far as we can tell, JMenuBar instances are not designed to be focusable. For example, the evaluation of CR 4707457 states:
"Menu elements do not receive focus since release 1.4.
Thus is not a bug, because the focusLost and focusGained events
never meant to be used to determine the status of the menus and
menu items."
Therefore the fix would seem to be as simple as setting JMenuBar to be unfocusable by default (see suggested fix).
REPRODUCTION INSTRUCTIONS
-------------------------
1. Launch the provided testcase (instructions included in the README file)
2. Select "Container Order" traversal policy
3. Now use TAB to traverse the application components
Observed result:
Focus traversal becomes impossible after it moves away from the JTree, because it is "stuck" at the JMenuBar
Expected result:
Focus traversal should not become "stuck" at the JMenuBar
SUGGESTED FIX
-------------
Provided in the Suggested Fix section of the CR.