Make sure special keys work in text fields
There is a bug in gwt 2.1.0 [1] that prevents that pressing special keys like Enter, Backspace etc. are properly recognized and so they have no effect. This problem only affects some browsers (e.g. Firefox, older versions of Google Chrome). A similar fix was already done to fix the Enter key for most text fields [2]. This change fixes another 3 cases: 1. Fix Enter key for adding group in PermissionEditor. This was already fixed by change 23994 [3], however this fix registered an additional KeyPressHandler instead of fixing the actual problem with Enter not being recognized in the already existing KeyPressHandler. So this fix was undone and instead the fix was done in the correct place. 2. Fix Enter, Backspace, Tab etc. for UsernameField which is e.g. used in the RegisterScreen where users have to enter there username. 3. Fix Enter, Backspace, Tab etc. for NpIntTextBox which is e.g. used for the Tab Width and Columns preferences when comparing files. [1] http://code.google.com/p/google-web-toolkit/issues/detail?id=5558 [2] https://review.source.android.com/22942 [3] https://review.source.android.com/23994 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com> Change-Id: I780f0ae034da537c2e8d3839cd08da24b5184573
This commit is contained in:
@@ -138,7 +138,8 @@ class UsernameField extends Composite {
|
||||
@Override
|
||||
public void onKeyPress(final KeyPressEvent event) {
|
||||
final char code = event.getCharCode();
|
||||
switch (code) {
|
||||
final int nativeCode = event.getNativeEvent().getKeyCode();
|
||||
switch (nativeCode) {
|
||||
case KeyCodes.KEY_ALT:
|
||||
case KeyCodes.KEY_BACKSPACE:
|
||||
case KeyCodes.KEY_CTRL:
|
||||
|
Reference in New Issue
Block a user