mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge pull request #72 from gaearon/search-bug
Don't move selection unless search text increased length
This commit is contained in:
@@ -309,10 +309,10 @@ function reduceSearchState(store: Store, state: State, action: Action): State {
|
||||
}
|
||||
|
||||
// Changes in search index or typing should override the selected element.
|
||||
if (
|
||||
searchIndex !== prevSearchIndex ||
|
||||
searchText.indexOf(prevSearchText) === 0
|
||||
) {
|
||||
const didAddToSearchText =
|
||||
searchText.length > prevSearchText.length &&
|
||||
searchText.indexOf(prevSearchText) === 0;
|
||||
if (searchIndex !== prevSearchIndex || didAddToSearchText) {
|
||||
if (searchIndex === null) {
|
||||
selectedElementIndex = null;
|
||||
selectedElementID = null;
|
||||
|
||||
Reference in New Issue
Block a user