sickdyd/react-search-autocomplete

Consider removing onMouseDown

Closed this issue · 9 comments

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

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

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.

@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.

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.

@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.

@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!

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",

@philipp985 I fixed this problem in the latest release!

Hi @sickdyd ,
this commit 3511365 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:

  • a) add an option hideOnBlur
  • b) add the on blur only to elements outside the whole component
    Any prefrerence? You need help?
    Thanks!