From 338c0add2d905ec87749a263ecb916f91e038f88 Mon Sep 17 00:00:00 2001 From: Nicolas Raynaud Date: Thu, 1 Dec 2016 00:13:57 +0100 Subject: [PATCH] try to focus the next available option after a selection. --- src/Select.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Select.js b/src/Select.js index bfeefc7554..d181c5f3c6 100644 --- a/src/Select.js +++ b/src/Select.js @@ -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 () {