sickdyd / react-search-autocomplete

A search box that filters the provided array of objects
https://sickdyd.github.io/react-search-autocomplete
MIT License
218 stars 82 forks source link

How can we apply enter keyword Search #47

Closed lavarajallu closed 2 years ago

lavarajallu commented 2 years ago

If I use the method like

<ReactSearchAutocomplete items={items} onSearch={handleOnSearch} onHover={handleOnHover} onSelect={handleOnSelect} onFocus={handleOnFocus} onKeyUp={handleKeyUp} onClear={handleClear} autoFocus formatResult={formatResult} />

const handleKeyUp = (e) => { console.log("event: ", e); if (e.charCode === 13 || e.key === "Enter") { console.log(Enter$, e); handleOnSearch();

}

};

is it possible to work in this module

PunkSage commented 2 years ago

Can you please describe the problem in more depth? Currently it's hard to understand what are you trying to achieve.

mkb0091 commented 2 years ago

I believe that this user is trying to get the text from the input when the user clicks "enter". If they do not explicitly select an option from the list, he still wants to be able to access the text contained in the search bar. I am also curious if this functionality exists.

Oops, just saw #38 , the solution there seems to do the trick!

sickdyd commented 2 years ago

Closed because workaround exists: https://github.com/sickdyd/react-search-autocomplete/issues/38