RFR: 8361606 : ConsumeNextMnemonicKeyTypedTest.java fails on Windows: character typed with VK_A: a [v3]
Alexey Ivanov
aivanov at openjdk.org
Thu Sep 25 16:36:07 UTC 2025
On Mon, 25 Aug 2025 10:43:51 GMT, Anass Baya <abaya at openjdk.org> wrote:
>> **Analysis :**
>> When the problem occurrs, the key press event related to the mnemonic triggers the item selection. However, as we returned to the menu, the subsequent key typed event arrived and was treated as a normal key press instead of being recognized as part of the mnemonic sequence.
>>
>> **Proposed Fix:**
>> As a fix, we are tagging the next key typed event to be consumed by the Keyboard Focus Manager
>>
>>
>> public void processKeyEvent(Component focusedComponent, KeyEvent e) {
>> // consume processed event if needed
>> if (consumeProcessedKeyEvent(e)) { <--- consumed here
>> return;
>> }
>> ...
>
> Anass Baya has updated the pull request incrementally with one additional commit since the last revision:
>
> add Linux bug ID 8321303
I am confused here.
> When the problem occurrs, the key press event related to the mnemonic triggers the item selection. However, as we returned to the menu, the subsequent key typed event arrived and was treated as a normal key press instead of being recognized as part of the mnemonic sequence.
The expectation is that <kbd>Alt</kbd>+<kbd>F</kbd> activates the menu bar and opens the popup menu associated with the `menu` top level menu. Then <kbd>I</kbd> should be processed by the menu, so that `item` gets selected and not only selected but activated—it fires up an `ActionEvent`.
> …the subsequent key typed event arrived and was treated…
Do you mean that the menu didn't consume `KEY_TYPED` after both `KEY_PRESSED` and `KEY_RELEASED` were handled to activate the menu item? In other words, `KEY_PRESSED` was processed quickly so that the menu disappeared before `KEY_TYPED` was dispatched?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26790#issuecomment-3335005663
More information about the client-libs-dev
mailing list