fmoo / react-typeahead

Pure react-based typeahead and typeahead-tokenizer
ISC License
677 stars 232 forks source link

Focus on text input when typeahead is clicked #215

Open rishadjb opened 7 years ago

rishadjb commented 7 years ago

When I click in the area of the typeahead (or tokenizer when using it), it doesn't focus on the text input field automatically. I have to click the input field to focus on it.

There is a .focus function, but there is no onClick for the typeahead, which I link the .focus to.

Is there way to do this? Hopefully my explanation is clear enough in what I intend to do.

Thanks.

larrydahooster commented 7 years ago

mar-16-2017 10-37-16

I think I am having the same issue like @rishadjb described above.

alexmassicott commented 6 years ago

yes i have the same issue, i have to click multiple times

Richard-Thompson commented 6 years ago

was there any fix for this? @alexmassicott @larrydahooster ?

alexmassicott commented 6 years ago

@Richard-Thompson

I fixed it by changing the react-typeahead manually in the index.js,

I added on change to the onChange event, replace the index.js in the lib folder in the node_module

I can give you my whole node_module folder if you need it. What causes the dropdown to trigger is this line in the typeahead index.js this.setState({ isFocused: true, showResults: true });

index.js.zip

fmoo commented 6 years ago

If someone wants to send a PR with this behavior behind an option (or if this is saner default behavior), I'll pick it up and do an alpha.8 release.