On Thu, 22 Feb 2024 11:11:01 GMT, Abhishek Kumar <abhis...@openjdk.org> wrote:

> Menu mnemonic doesn't toggle between show and hide state when F10 is pressed. 
> Behavior is not similar to windows native application. Fix is to ensure that 
> menu mnemonic state toggles between show and hide.
> 
> Can be verified with SwingSet2 application. 
> CI tests are green with the fix. Link posted in JBS.

Based on the above comment, additional changes are required. F10 in Windows L&F 
should release focus from the menu bar.

Alt key handles this, see 
[`WindowsRootPaneUI.AltProcessor`](https://github.com/openjdk/jdk/blob/a93605f7fb0fbe22c7bdffc8eb6db4d660eec3d1/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsRootPaneUI.java#L80)
 for ideas.

Let's see what happens to Notepad on Windows 10.

Pressing F10 key selects the File menu in the menu bar and displays mnemonics:  
![File menu in the menu bar is selected after F10 is 
pressed](https://github.com/openjdk/jdk/assets/70774172/839bd2eb-cee0-4b15-b0ab-f7f2377f9650)

Pressing F10 for the second time, unselects the menu and hides mnemonics:  
![File menu in the menu bar is not selected any 
more](https://github.com/openjdk/jdk/assets/70774172/66bfd26d-182c-4789-8998-796bb86ace24)

-------------

Changes requested by aivanov (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/17961#pullrequestreview-1906613974

Reply via email to