Fix KeyCommandSet for special keys on some browsers

The Enter key doesn't execute OpenKeyCommand on Firefox (See
http://code.google.com/p/google-web-toolkit/issues/detail?id=5003).
http://code.google.com/p/google-web-toolkit/source/detail?r=7692
caused event.getCharCode() to return 0 for special keys on some
browsers. This prevented the event from being passed on to the
KeyCommand. Fixed by adding an additional check in KeyCommandSet
that restores the actual key code.

Change-Id: Ie48aa5de3d22a3561192ac91f226234adeb7382f
This commit is contained in:
Michael Zhou
2013-08-17 01:02:49 -07:00
parent cdbcc65fcd
commit 9ff7226a81

View File

@@ -121,7 +121,10 @@ public class KeyCommandSet implements KeyPressHandler {
}
static int toMask(final KeyPressEvent event) {
int mask = event.getCharCode();
int mask = event.getUnicodeCharCode();
if (mask == 0) {
mask = event.getNativeEvent().getKeyCode();
}
if (event.isAltKeyDown()) {
mask |= KeyCommand.M_ALT;
}