From a0972e3855a3766c426a83a220292af30a95cce9 Mon Sep 17 00:00:00 2001 From: Konstantyn Maryanovsky Date: Tue, 31 Jan 2017 20:17:17 +0200 Subject: [PATCH] Fixed bug. Looking for focusedOption can return incorrect value in case when focusedOption not equal to any element of array, IE compatible --- src/Select.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Select.js b/src/Select.js index 0396fb7660..3f18a524ff 100644 --- a/src/Select.js +++ b/src/Select.js @@ -1009,7 +1009,14 @@ const Select = React.createClass({ let focusedOption = this.state.focusedOption || selectedOption; if (focusedOption && !focusedOption.disabled) { - const focusedOptionIndex = options.findIndex(option => option.value === focusedOption.value); + let focusedOptionIndex = -1; + options.some((option, index) => { + const isOptionEqual = option.value === focusedOption.value; + if (isOptionEqual) { + focusedOptionIndex = index; + } + return isOptionEqual; + }); if (focusedOptionIndex !== -1) { return focusedOptionIndex; }