diff --git a/e2e/integration/search.e2e.ts b/e2e/integration/search.e2e.ts index e4ffd5ab..a44cafb7 100644 --- a/e2e/integration/search.e2e.ts +++ b/e2e/integration/search.e2e.ts @@ -27,6 +27,8 @@ describe('Search', () => { it('should support arrow navigation', () => { getSearchInput().type('int', { force: true }); + cy.wait(500); + getSearchInput().type('{downarrow}', { force: true }); getResult(0).should('have.class', 'active'); diff --git a/src/components/SearchBox/SearchBox.tsx b/src/components/SearchBox/SearchBox.tsx index e6ade2c3..5476dc9b 100644 --- a/src/components/SearchBox/SearchBox.tsx +++ b/src/components/SearchBox/SearchBox.tsx @@ -7,6 +7,7 @@ import { MenuItem } from '../SideMenu/MenuItem'; import { MarkerService } from '../../services/MarkerService'; import { SearchResult } from '../../services/SearchWorker.worker'; +import { bind, debounce } from 'decko'; import { PerfectScrollbarWrap } from '../../common-elements/perfect-scrollbar'; import { ClearIcon, @@ -94,11 +95,18 @@ export class SearchBox extends React.PureComponent { + this.setResults(res, searchTerm); + }); + } + search = (event: React.ChangeEvent) => { const q = event.target.value; if (q.length < 3) { @@ -106,13 +114,12 @@ export class SearchBox extends React.PureComponent { - this.setResults(res, q); - }); + this.setState( + { + term: q, + }, + () => this.searchCallback(this.state.term), + ); }; render() {