GWT KeyPressHandler getCharCode issues

Like hundreds of GWT developers I stepped into the annoying GWT KeyPressEvent.getCharCode() bug problem described here
To turn around this bug i tried using:


the purpose is to access the native event to get the unprocessed code. However if you try the


you will knock your head against browser-specific inconsistencies. For example the getCharCode() from NativeEvent works for me in FireFox 3 but it doesn’t work in Chrome . in Chrome if i press “ENTER” key




in FF3 the two values are equal (’13’).
It appears that a fix for KeyPressHandler was completed and reviewed for this issue . but it is not clear when we could expect it to be released. The fix appears fairly complex, with different browser-specific implementations.
it turns out that this change set is actually exactly what causes the current behavior in Firefox. See the rationale and a workaround/fix (i.e. only use getNativeEvent() when getCharCode returns 0).
the workaround above works but we need to replace ’13’ with ’10’ in the fix code portion below :

} else if (charCode == 13) {


using ’10’ instead of ’13’ in the else if conditional:

} else if (charCode == 10) {


with this new change code works both in chrome and FF3.

Hope this could be helpful for anyone experiencing these GWT keyPress getCharCode() problems.