Skip to content
This repository has been archived by the owner on Jul 19, 2019. It is now read-only.

Add new optional prop isItemAutoHighlightMatch #337

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bfncs
Copy link

@bfncs bfncs commented May 4, 2018

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.

@bfncs
Copy link
Author

bfncs commented May 17, 2018

Please let me know how I can help to get this merged or find a better solution.

@zackify
Copy link

zackify commented Aug 29, 2018

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 :(

@chalda
Copy link

chalda commented Feb 22, 2019

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

autoHighlight={true} only highlights the first item - if it matches from its beginning
3 participants