Skip to content

Commit

Permalink
Fix selected option focus when valueKey is not "value" (JedWatson#1733)
Browse files Browse the repository at this point in the history
* 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/
  • Loading branch information
Betree authored and Billy Vong committed May 25, 2017
1 parent ed9f879 commit b655559
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -1025,11 +1025,12 @@ const Select = createClass({
var options = this._visibleOptions;
if (!options.length) return null;

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

0 comments on commit b655559

Please sign in to comment.