RFR: 8326458: Menu mnemonic doesn't toggle between show and hide in Windows LAF when F10 is pressed.
Alexey Ivanov
aivanov at openjdk.org
Wed Feb 28 15:48:52 UTC 2024
On Thu, 22 Feb 2024 11:11:01 GMT, Abhishek Kumar <abhiscxk at 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:

Pressing F10 for the second time, unselects the menu and hides mnemonics:

-------------
Changes requested by aivanov (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/17961#pullrequestreview-1906613974
More information about the client-libs-dev
mailing list