On Mon, 25 Aug 2025 10:43:51 GMT, Anass Baya <[email protected]> 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

Hello @DamonGuy,

> > I'm not able to reproduce the issue on macOS. Could you please attach the 
> > logs so I can take a look and see if it's related to not consuming the 
> > "Next Mnemonic KeyTyped event"?
> 
> This is the output when it fails on macOS 15.6 (Aqua L&F) on the mainline 
> JDK. You mentioned you don't see the same result?
> 
> ```
> ----------System.out:(1/50)----------
> Test: character typed after mnemonic key press: i
> ----------System.err:(13/744)----------
> Test: character typed with VK_A: a
> java.lang.RuntimeException: Test failed!
>       at 
> ConsumeNextMnemonicKeyTypedTest.test(ConsumeNextMnemonicKeyTypedTest.java:154)
>       at 
> ConsumeNextMnemonicKeyTypedTest.main(ConsumeNextMnemonicKeyTypedTest.java:63)
>       at 
> java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
>       at java.base/java.lang.reflect.Method.invoke(Method.java:565)
>       at 
> com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
>       at java.base/java.lang.Thread.run(Thread.java:1474)
> 
> JavaTest Message: Test threw exception: java.lang.RuntimeException: Test 
> failed!
> JavaTest Message: shutting down test
> 
> STATUS:Failed.`main' threw exception: java.lang.RuntimeException: Test failed!
> ```

Thank you for your test. I'm not able to reproduce the issue on macOS, but this 
is the exact bug we are targeting with the proposed fix. The 'i' key typed 
event is not being consumed, which is why it appears in the log of your test:
`Test: character typed after mnemonic key press: i 
`
I will run the test in a loop on a local mac host with Aqua L&F and see if I 
can reproduce it. In the meantime, could you please confirm whether the 
proposed fix resolves the issue on macOS, since you're able to reproduce it 
there?

KR,

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

PR Comment: https://git.openjdk.org/jdk/pull/26790#issuecomment-3239509588

Reply via email to