Tab can now be used for selection of address from list, as well as adding a manual mxid or email address

This commit is contained in:
wmwragg 2016-09-14 14:53:13 +01:00
parent 2752d6b444
commit 2a8518b72b
2 changed files with 8 additions and 8 deletions

View file

@ -108,16 +108,16 @@ module.exports = React.createClass({
} else if (e.keyCode === 38) { // up arrow
e.stopPropagation();
e.preventDefault();
this.addressSelector.onKeyUpArrow();
this.addressSelector.onKeyU();
} else if (e.keyCode === 40) { // down arrow
e.stopPropagation();
e.preventDefault();
this.addressSelector.onKeyDownArrow();
} else if (e.keyCode === 13) { // enter
this.addressSelector.onKeyDown();
} else if (e.keyCode === 13 || (e.keyCode === 9 && this.state.queryList.length > 0)) { // enter or tab
e.stopPropagation();
e.preventDefault();
this.addressSelector.onKeyReturn();
} else if (e.keyCode === 32 || e.keyCode === 188) { // space or comma
this.addressSelector.onKeySelect();
} else if (e.keyCode === 32 || e.keyCode === 188 || e.keyCode === 9) { // space, comma or tab
e.stopPropagation();
e.preventDefault();
var check = Invite.isValidAddress(this.refs.textinput.value);

View file

@ -55,7 +55,7 @@ module.exports = React.createClass({
}
},
onKeyUpArrow: function() {
onKeyUp: function() {
if (this.state.selected > 0) {
this.setState({
selected: this.state.selected - 1,
@ -64,7 +64,7 @@ module.exports = React.createClass({
}
},
onKeyDownArrow: function() {
onKeyDown: function() {
if (this.state.selected < this._maxSelected(this.props.addressList)) {
this.setState({
selected: this.state.selected + 1,
@ -73,7 +73,7 @@ module.exports = React.createClass({
}
},
onKeyReturn: function() {
onKeySelect: function() {
this.selectAddress(this.state.selected);
},