RFR: 8326458: Menu mnemonic doesn't toggle between show and hide in Windows LAF when F10 is pressed. [v2]
Alexey Ivanov
aivanov at openjdk.org
Thu Feb 29 11:27:54 UTC 2024
On Thu, 29 Feb 2024 07:42:44 GMT, Abhishek Kumar <abhiscxk at openjdk.org> wrote:
> > This needs testing with popup menus and combobox popups.
>
> Popup menus doesn't show mnemonics in windows LAF by default. On press of alt or F10, popup menu windows becomes invisible.
This statement is generally false. Popup menus on Windows do show mnemonics if popup is *activated* with a keyboard. As I said, Swing does not implement hiding mnemonics and focus indicators correctly on Windows correctly, it doesn't hide focus indicators at all. The [`WM_UPDATEUISTATE`](https://learn.microsoft.com/en-us/windows/win32/menurc/wm-updateuistate), [`WM_CHANGEUISTATE`](https://learn.microsoft.com/en-us/windows/win32/menurc/wm-changeuistate) and [`WM_QUERYUISTATE`](https://learn.microsoft.com/en-us/windows/win32/menurc/wm-queryuistate) message are used to control the state of both mnemonics (accelerators in Windows terms) and focus indicators.
> Not sure if we can add mnemonics to combobox popups or how to test this?
Anyway, what I meant is that you have to test the behaviour of F10 when a popup menu (possibly cascaded) is displayed on the screen, when a combobox popup is displayed on the screen. You need to perform additional testing.
Is it possible to write a regression and/or unit test?
You could add `@modules java.desktop/com.sun.java.swing.plaf.windows` to jtreg tags and access the `com.sun.java.swing.plaf.windows.WindowsLookAndFeel.isMnemonicHidden` method to verify that the mnemonics are shown or hidden based on how many times you (the `Robot`) pressed F10 key as well as the menu bar is active or not.
More complicated scenarios where F10 is pressed while a popup menu is shown or combobox popup is open could also be tested but require more effort with the benefit of confirming that this scenarios work as expected.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17961#issuecomment-1970927841
More information about the client-libs-dev
mailing list