File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,9 @@ var eventTypes = {
69
69
// Track characters inserted via keypress and composition events.
70
70
var fallbackChars = null ;
71
71
72
+ // Track whether we've ever handled a keypress on the space key.
73
+ var hasSpaceKeypress = false ;
74
+
72
75
/**
73
76
* Return whether a native keypress event is assumed to be a command.
74
77
* This is required because Firefox fires `keypress` events for key commands
@@ -138,16 +141,18 @@ var BeforeInputEventPlugin = {
138
141
return ;
139
142
}
140
143
141
- chars = String . fromCharCode ( which ) ;
144
+ hasSpaceKeypress = true ;
145
+ chars = SPACEBAR_CHAR ;
142
146
break ;
143
147
144
148
case topLevelTypes . topTextInput :
145
149
// Record the characters to be added to the DOM.
146
150
chars = nativeEvent . data ;
147
151
148
152
// If it's a spacebar character, assume that we have already handled
149
- // it at the keypress level and bail immediately.
150
- if ( chars === SPACEBAR_CHAR ) {
153
+ // it at the keypress level and bail immediately. Android Chrome
154
+ // doesn't give us keycodes, so we need to blacklist it.
155
+ if ( chars === SPACEBAR_CHAR && hasSpaceKeypress ) {
151
156
return ;
152
157
}
153
158
You can’t perform that action at this time.
0 commit comments