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

Consider removing onMouseDown #59

Closed philipp985 closed 2 years ago

philipp985 commented 2 years ago

Hi, thank you for the work and the good library. I have one improvement to suggest. Is it possible to remvoe the onMouseDonw here https://github.com/sickdyd/react-search-autocomplete/blob/master/src/components/Results.tsx#L54 Because with mouse down you also select via every other click then a normal left click. I think this is not intuitive. I don't know if this would have any side effects but I would consider it as the normal behaviour. Thanks Philipp

sickdyd commented 2 years ago

@philipp985 I removed onMouseDown since it was redundant. Please try the new version 6.1.2.

philipp985 commented 2 years ago

Hi @sickdyd thanks! I think it more like what a normal user would expect. For my current implementation where I am rendering a link in the dropdown I would like to right click to open the link in a new tab. But that might be a special edge case. Also I dont know how this could be solved. Maybe make the onClick event overwriteable? But anyhow that's not an urgent topic.

sickdyd commented 2 years ago

@philipp985 That ccould be implemented with a prop onRighClick that is used in case the right mouse button is used. Shouldn't bee to hard to implement. I'll add it when I have some time.

philipp985 commented 2 years ago

Hi, sorry to bug you again. But with the latest version 6.1.2 the selection via mouse is not working anymore. It is only possible to select via keyboard enter. I took a quick glance at the changes. I don't know why it happens. If I am not wrong your example page has the same problem.

sickdyd commented 2 years ago

@philipp985 Wow... I missed that. Thank you for reporting it! I reverted the commit. I'll look into it as soon as I have time.

sickdyd commented 2 years ago

@philipp985 I deployed another version that should work as expected and allow to use the right click on the results. Try version 7.2.0. Cheers!

philipp985 commented 2 years ago

Hi @sickdyd thanks a lot right click works now, perfect! But I am using the library with TS and webpack. And now vs code complains that Could not find a declaration file for module 'react-search-autocomplete'. 'C:/Users/xxx/node_modules/react-search-autocomplete/dist/index.js' implicitly has an 'any' type.

Any idea why? I looked at the changes but couldn't find anything related to that. I used "react-search-autocomplete": "7.2.1",

sickdyd commented 2 years ago

@philipp985 I fixed this problem in the latest release!

philipp985 commented 1 year ago

Hi @sickdyd , this commit https://github.com/sickdyd/react-search-autocomplete/commit/3511365eefd5170fe35704006ab177757d30ae23 leads again to the described problem that you can not right click a link for example. In general I see the point for this idea. What about one of these two options: