Trigger event with query when Enter key is pressed
I'd like to be able to retrieve the query even when the Enter key is pressed, even when an autocomplete option isn't selected, so that the user can submit queries that aren't in the autocomplete options.
HI @cleercode! I have a PR for this improvement. I think its functionality is adaptable to your issue. https://github.com/reactjs/react-autocomplete/pull/83
I really would like that functionality, too. In my scenario the user can select from a number of options but should also be able to add new items. At least in some cases so the discussed "onSearch" handler would be optimal for me.
Any chance that pull request might get merged?
I would argue that this is input behavior, not autocomplete behavior. You can easily handle this use case by catching "enter" keypresses in the input's onKeyUp handler and performing your logic with the input value.