Skip to content

Commit

Permalink
Merge pull request JedWatson#1406 from nraynaud/master
Browse files Browse the repository at this point in the history
try to focus the next available option after a selection.
  • Loading branch information
JedWatson authored Jan 31, 2017
2 parents b6a0636 + 338c0ad commit 912cbb8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,13 @@ const Select = React.createClass({
addValue (value) {
var valueArray = this.getValueArray(this.props.value);
this.setValue(valueArray.concat(value));
const visibleOptions = this._visibleOptions.filter(val => !val.disabled);
const index = visibleOptions.indexOf(value);
if (visibleOptions.length > index + 1) {
this.focusOption(visibleOptions[index + 1]);
} else if (index > 0) {
this.focusOption(visibleOptions[index - 1]);
}
},

popValue () {
Expand Down

0 comments on commit 912cbb8

Please sign in to comment.