fmoo / react-typeahead

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

Project is poorly documented / needs a re-documentation #254

Open stavlocker opened 5 years ago

stavlocker commented 5 years ago

I'm editing this once again for another problem that also has to do with the documentation.

Hi. I love this project, it's helped me a lot. But it's really underdocumented. The first thing that's not documented at all is programmatically clearing the input's value. It took me a lot of time to find the solution, which is the Typeahead ref

//In constructor:
this.typeaheadRef = React.createRef();
//Prop on the Typeahead component:
ref={this.typeaheadRef}
//Resetting:
this.typeaheadRef.current.setEntryText("");

Not only this feature isn't documented here, the word ref isn't mentioned once in the README.md. Once. (Ctrl + F > ref)

Another feature that's not documented that I luckily found out about is that Typeahead actually does support arrow key navigation between options, but it doesn't show - it just gives the hover class to the element in focus. That's fine as a solution, but once again it's not mentioned anywhere.

The project really needs a re-documentation or just a fixing of the documentation to include all those features that make the project even better but aren't shown anywhere.

stavlocker commented 5 years ago

This issue was originally about me not knowing how to clear input value, because it's not documented. Then I luckily found out how to do that, so it was about the documentation lacking in the subject of clearing input.

Then I tried to implement my own arrow navigation after finding no results online, and then found out that there's a secret arrow key navigation with the hover class. What?

The documentation really needs a revamp to include all those "secret" features, with examples and categories. These two issues are probably not the only ones that aren't documented.