Skip to content

Commit

Permalink
try to focus the next available option after a selection.
Browse files Browse the repository at this point in the history
  • Loading branch information
nraynaud committed Nov 30, 2016
1 parent ef3a468 commit 338c0ad
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Select.js
Expand Up @@ -630,6 +630,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 338c0ad

Please sign in to comment.