Skip to content

Commit bb75169

Browse files
authored
Merge pull request #1512 from rndm2/master
Fixed bug. No more comparing objects in getFocusableOptionIndex
2 parents 2249f26 + a0972e3 commit bb75169

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Select.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,14 @@ const Select = React.createClass({
10241024

10251025
let focusedOption = this.state.focusedOption || selectedOption;
10261026
if (focusedOption && !focusedOption.disabled) {
1027-
const focusedOptionIndex = options.indexOf(focusedOption);
1027+
let focusedOptionIndex = -1;
1028+
options.some((option, index) => {
1029+
const isOptionEqual = option.value === focusedOption.value;
1030+
if (isOptionEqual) {
1031+
focusedOptionIndex = index;
1032+
}
1033+
return isOptionEqual;
1034+
});
10281035
if (focusedOptionIndex !== -1) {
10291036
return focusedOptionIndex;
10301037
}

0 commit comments

Comments
 (0)