Skip to content

Commit

Permalink
Merge pull request JedWatson#1512 from rndm2/master
Browse files Browse the repository at this point in the history
Fixed bug. No more comparing objects in getFocusableOptionIndex
  • Loading branch information
JedWatson authored Mar 17, 2017
2 parents 2249f26 + a0972e3 commit bb75169
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,14 @@ const Select = React.createClass({

let focusedOption = this.state.focusedOption || selectedOption;
if (focusedOption && !focusedOption.disabled) {
const focusedOptionIndex = options.indexOf(focusedOption);
let focusedOptionIndex = -1;
options.some((option, index) => {
const isOptionEqual = option.value === focusedOption.value;
if (isOptionEqual) {
focusedOptionIndex = index;
}
return isOptionEqual;
});
if (focusedOptionIndex !== -1) {
return focusedOptionIndex;
}
Expand Down

0 comments on commit bb75169

Please sign in to comment.