Looks fine.

On 10/10/2018 23:31, Prasanta Sadhukhan wrote:
Hi All,

Please review a fix for an issue where it is seen that 
typing(pressing+releaseing) ALT key in a JTextArea transfer focus to and 
activates JMenu (rather than focus staying in textarea)
if both JTextArea and JMenu are present in a JFrame,
even if there is a KeyListener on the text component that consumes the KeyEvent 
generated when releasing the Alt key.

This is a regression of JDK-8173145: 
<https://bugs.openjdk.java.net/browse/JDK-8173145>Menu is activated after using 
mnemonic Alt/Key combination
where a check is amended in AltProcessor#postProcessKeyEvent
if(ev.isConsumed()) {
                 // do not manage consumed event
                 return false;
             }

to :
if(ev.isConsumed() && ev.getKeyCode() != KeyEvent.VK_ALT) {
                 // mnemonic combination, it's consumed, but we need
                 // set altKeyPressed to false, otherwise after selection
                 // component by mnemonic combination a menu will be open
                 altKeyPressed = false;
                 return false;
             }
to ensure key-binding action is executed when not-alt key pressed.
But the above fix also prevents the postProcessKeyEvent to return even when ALT 
event is consumed.
Proposed fix is to ensure postProcessKeyEvent returns if event is consumed and 
also ensures the previous check of resetting altKeyPressed occurs for non-alt 
combination.

With this fix, the regression testcase of JDK-8173145 
<https://bugs.openjdk.java.net/browse/JDK-8173145>also works ok.

Bug: https://bugs.openjdk.java.net/browse/JDK-8211987
webrev: http://cr.openjdk.java.net/~psadhukhan/8211987/webrev.0/

Regards
Prasanta
<https://bugs.openjdk.java.net/browse/JDK-8173145>


--
Best regards, Sergey.

Reply via email to