sickdyd / react-search-autocomplete

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

When clicking with the mouse into the field, the autocomplete list shows only for a sec #105

Open munichdeveloper opened 1 year ago

munichdeveloper commented 1 year ago

Describe the bug When clicking with the mouse into the field, the autocomplete list shows only for a sec. When tabbing into the field, the items are shown as expected, whereas when you click with the mouse, the values are only being shown for a second (you can hold the mouse button, then they will remain also)

Expected behavior The list with the values stays open, until a value is selected, either by mouseclick, or by navigating with the arrows from keyboard.

sickdyd commented 1 year ago

@munichdeveloper I am unable to reproduce the issue, could you please create a codesandbox?

carlosvallejo101 commented 1 year ago

Same here!

Manal-Bouriba commented 1 year ago

I think what they're trying to say is that when showItemsOnFocus is set to true, the results only stay on screen for an instant before disappearing, they're supposed to stay on screen until the user clicks outside the input field I'm facing the same problem.

IshfaqAhmedProg commented 1 year ago

Did anybody find a fix to this issue?

ZionLG commented 1 year ago

Have this issue as well

miracleonyenma commented 8 months ago

@sickdyd Greetings! It's an amazing package you've built here an I really appreciate all the time and effort you've put into making this so awesome. It's better than most of the other search/autoccomplete packages I've tried.

The only issue I'm facing currently is that even with the showItemsOnFocus set to true, the result items only show of a short moment on click, as soon as the user releases the click, it disappears. Here's a codesandbox reproduction of the issue.

https://github.com/sickdyd/react-search-autocomplete/assets/42788603/6e8286dc-cd3a-4740-b735-ef8e104734b9

Thanks for your assistance

MarkusRohlof commented 4 months ago

I found that the results stay until the mouse button is released.

I think this may be due the addition of handleDocumentClick instead of relying on onBlur. My guess would be that releasing the click on the input field counts as a document click and is interpreted as clicking anywhere in the document, leading to the result list being cleared.

https://github.com/sickdyd/react-search-autocomplete/blob/master/src/components/ReactSearchAutocomplete.tsx#L116-L125