File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
src/components/views/dialogs Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,8 @@ module.exports = createReactClass({
142
142
} ,
143
143
144
144
onKeyDown : function ( e ) {
145
+ const textInput = this . _textinput . current ? this . _textinput . current . value : undefined ;
146
+
145
147
if ( e . keyCode === 27 ) { // escape
146
148
e . stopPropagation ( ) ;
147
149
e . preventDefault ( ) ;
@@ -158,23 +160,23 @@ module.exports = createReactClass({
158
160
e . stopPropagation ( ) ;
159
161
e . preventDefault ( ) ;
160
162
if ( this . addressSelector ) this . addressSelector . chooseSelection ( ) ;
161
- } else if ( this . _textinput . current . value . length === 0 && this . state . selectedList . length && e . keyCode === 8 ) { // backspace
163
+ } else if ( textInput . length === 0 && this . state . selectedList . length && e . keyCode === 8 ) { // backspace
162
164
e . stopPropagation ( ) ;
163
165
e . preventDefault ( ) ;
164
166
this . onDismissed ( this . state . selectedList . length - 1 ) ( ) ;
165
167
} else if ( e . keyCode === 13 ) { // enter
166
168
e . stopPropagation ( ) ;
167
169
e . preventDefault ( ) ;
168
- if ( this . _textinput . current . value === '' ) {
170
+ if ( textInput === '' ) {
169
171
// if there's nothing in the input box, submit the form
170
172
this . onButtonClick ( ) ;
171
173
} else {
172
- this . _addAddressesToList ( [ this . _textinput . current . value ] ) ;
174
+ this . _addAddressesToList ( [ textInput ] ) ;
173
175
}
174
- } else if ( e . keyCode === 188 || e . keyCode === 9 ) { // comma or tab
176
+ } else if ( textInput && ( e . keyCode === 188 || e . keyCode === 9 ) ) { // comma or tab
175
177
e . stopPropagation ( ) ;
176
178
e . preventDefault ( ) ;
177
- this . _addAddressesToList ( [ this . _textinput . current . value ] ) ;
179
+ this . _addAddressesToList ( [ textInput ] ) ;
178
180
}
179
181
} ,
180
182
You can’t perform that action at this time.
0 commit comments