Skip to content

Commit 9943711

Browse files
Betreeagirton
authored andcommitted
Fix selected option focus when valueKey is not "value" (JedWatson#1733)
* Fix selected option focus when valueKey is not "value" * Revert "Fix selected option focus when valueKey is not "value"" This reverts commit 45f5665. * Fix on src/ instead of lib/
1 parent 196c7bb commit 9943711

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Select.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1025,11 +1025,12 @@ const Select = createClass({
10251025
var options = this._visibleOptions;
10261026
if (!options.length) return null;
10271027

1028+
const valueKey = this.props.valueKey;
10281029
let focusedOption = this.state.focusedOption || selectedOption;
10291030
if (focusedOption && !focusedOption.disabled) {
10301031
let focusedOptionIndex = -1;
10311032
options.some((option, index) => {
1032-
const isOptionEqual = option.value === focusedOption.value;
1033+
const isOptionEqual = option[valueKey] === focusedOption[valueKey];
10331034
if (isOptionEqual) {
10341035
focusedOptionIndex = index;
10351036
}

0 commit comments

Comments
 (0)