diff --git a/src/devtools/views/Components/TreeContext.js b/src/devtools/views/Components/TreeContext.js index 1b3fa5c2..3e053722 100644 --- a/src/devtools/views/Components/TreeContext.js +++ b/src/devtools/views/Components/TreeContext.js @@ -195,6 +195,7 @@ function reduceSearchState(store: Store, state: State, action: Action): State { } = state; const prevSearchIndex = searchIndex; + const prevSearchText = searchText; const numPrevSearchResults = searchResults.length; // Search isn't supported when the owner's tree is active. @@ -307,8 +308,8 @@ function reduceSearchState(store: Store, state: State, action: Action): State { } } - // Changes in search index should override the selected element. - if (searchIndex !== prevSearchIndex) { + // Changes in search index or typing should override the selected element. + if (searchIndex !== prevSearchIndex || searchText.indexOf(prevSearchText) === 0) { if (searchIndex === null) { selectedElementIndex = null; selectedElementID = null;