Skip to content

Commit c4529fa

Browse files
Clearing the global search bar will reset suggestions (#88637)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
1 parent bdde884 commit c4529fa

2 files changed

Lines changed: 2 additions & 5 deletions

File tree

x-pack/plugins/global_search_bar/public/components/search_bar.test.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,7 @@ describe('SearchBar', () => {
6666
};
6767

6868
const simulateTypeChar = async (text: string) => {
69-
await waitFor(() =>
70-
getSearchProps(component).onKeyUpCapture({ currentTarget: { value: text } })
71-
);
69+
await waitFor(() => getSearchProps(component).onInput({ currentTarget: { value: text } }));
7270
};
7371

7472
const getDisplayedOptionsTitle = () => {

x-pack/plugins/global_search_bar/public/components/search_bar.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,7 @@ export function SearchBar({
398398
</EuiHeaderSectionItemButton>
399399
}
400400
searchProps={{
401-
onKeyUpCapture: (e: React.KeyboardEvent<HTMLInputElement>) =>
402-
setSearchValue(e.currentTarget.value),
401+
onInput: (e: React.UIEvent<HTMLInputElement>) => setSearchValue(e.currentTarget.value),
403402
'data-test-subj': 'nav-search-input',
404403
inputRef: setSearchRef,
405404
compressed: true,

0 commit comments

Comments
 (0)