Open bfncs opened 6 years ago
Please let me know how I can help to get this merged or find a better solution.
Really confused why the maintainers don't want to add this. My autocomplete results have other fields that match on them, and the top one should always get highlighted :(
having a slightly different issue which also results in items not autohighlighting because of the highlighting function in the lib. this PR would help since this exposes the highlighting logic and i can just reimplement it for my own datamodel
I added a new optional prop isItemAutoHighlightMatch that allows injecting a function to determine whether an item should be autohighlighted. The default prop implementation checks whether the value of the proposed item starts with the search value ignoring case, so there is no change in the default behaviour.
This would fix #266, #239, #310 and #239 without braking backwards compatibility or making a more involved design in the future less feasible. If this is ok, I'd gladly add some documentation, but I wanted to ask for some comments first. I think this feature is essential for advanced usage of react-autocomplete with own matching implementations.