Skip to content

Commit ea40ef1

Browse files
author
James Rogers
committed
Merge branch 'JedWatson:master'
2 parents 2bcb998 + 93c3009 commit ea40ef1

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ function onInputKeyDown(event) {
389389
scrollMenuIntoView | bool | true | whether the viewport will shift to display the entire menu when engaged
390390
searchable | bool | true | whether to enable searching feature or not
391391
searchPromptText | string\|node | 'Type to search' | label to prompt for search input
392+
loadingPlaceholder | string\|node | 'Loading...' | label to prompt for loading search result
392393
tabSelectsValue | bool | true | whether to select the currently focused value when the `[tab]` key is pressed
393394
value | any | undefined | initial field value
394395
valueKey | string | 'value' | the option property to use for the value

lib/Select.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ var Select = _react2['default'].createClass({
451451
});
452452
} else {
453453
// otherwise, focus the input and open the menu
454-
this._openAfterFocus = true;
454+
this._openAfterFocus = this.props.openOnFocus;
455455
this.focus();
456456
}
457457
},
@@ -1346,4 +1346,4 @@ var Select = _react2['default'].createClass({
13461346
});
13471347

13481348
exports['default'] = Select;
1349-
module.exports = exports['default'];
1349+
module.exports = exports['default'];

src/Async.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const propTypes = {
1313
React.PropTypes.node
1414
]),
1515
loadOptions: React.PropTypes.func.isRequired, // callback to load options asynchronously; (inputValue: string, callback: Function): ?Promise
16+
multi: React.PropTypes.bool, // multi-value input
1617
options: PropTypes.array.isRequired, // array of options
1718
placeholder: React.PropTypes.oneOfType([ // field placeholder, displayed when there's no value (shared with Select)
1819
React.PropTypes.string,

src/Select.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ const Select = React.createClass({
399399
});
400400
} else {
401401
// otherwise, focus the input and open the menu
402-
this._openAfterFocus = true;
402+
this._openAfterFocus = this.props.openOnFocus;
403403
this.focus();
404404
}
405405
},
@@ -1132,7 +1132,14 @@ const Select = React.createClass({
11321132

11331133
let focusedOption = this.state.focusedOption || selectedOption;
11341134
if (focusedOption && !focusedOption.disabled) {
1135-
const focusedOptionIndex = options.indexOf(focusedOption);
1135+
let focusedOptionIndex = -1;
1136+
options.some((option, index) => {
1137+
const isOptionEqual = option.value === focusedOption.value;
1138+
if (isOptionEqual) {
1139+
focusedOptionIndex = index;
1140+
}
1141+
return isOptionEqual;
1142+
});
11361143
if (focusedOptionIndex !== -1) {
11371144
return focusedOptionIndex;
11381145
}

0 commit comments

Comments
 (0)