Skip to content

Commit eaabe35

Browse files
committed
Stop trapping tab in AddressPickerDialog
1 parent 3ec60b1 commit eaabe35

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/components/views/dialogs/AddressPickerDialog.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ module.exports = createReactClass({
142142
},
143143

144144
onKeyDown: function(e) {
145+
const textInput = this._textinput.current ? this._textinput.current.value : undefined;
146+
145147
if (e.keyCode === 27) { // escape
146148
e.stopPropagation();
147149
e.preventDefault();
@@ -158,23 +160,23 @@ module.exports = createReactClass({
158160
e.stopPropagation();
159161
e.preventDefault();
160162
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
162164
e.stopPropagation();
163165
e.preventDefault();
164166
this.onDismissed(this.state.selectedList.length - 1)();
165167
} else if (e.keyCode === 13) { // enter
166168
e.stopPropagation();
167169
e.preventDefault();
168-
if (this._textinput.current.value === '') {
170+
if (textInput === '') {
169171
// if there's nothing in the input box, submit the form
170172
this.onButtonClick();
171173
} else {
172-
this._addAddressesToList([this._textinput.current.value]);
174+
this._addAddressesToList([textInput]);
173175
}
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
175177
e.stopPropagation();
176178
e.preventDefault();
177-
this._addAddressesToList([this._textinput.current.value]);
179+
this._addAddressesToList([textInput]);
178180
}
179181
},
180182

0 commit comments

Comments
 (0)