reactjs / react-autocomplete

WAI-ARIA compliant React autocomplete (combobox) component
MIT License
2.17k stars 532 forks source link

highlighted item always resetting on arrowUp/-down #244

Closed ptrwllrt closed 7 years ago

ptrwllrt commented 7 years ago

Could it be that https://github.com/reactjs/react-autocomplete/blob/master/lib/Autocomplete.js#L178 always returns true and therefore resets the highlighted index 5 lines down?

I have this issue right now that everytime I hit arrowUp or down on the keyboard. The result is the highlight is stuck on the first item (with enabled "autoHighlight")

I'm not sure if it is a bug or I'm just using this lib wrong. The items array gets created some components above and simply passed down.

CMTegner commented 7 years ago

Hi Peter! Hitting up/down arrow doesn't invoke componentWillReceiveProps, unless you've provided your own onKeyDown handler that mutates state outside of Autocomplete, which in turn modifies its props.

It would be great if you could create a reduced test case for this so we can debug it further.

CMTegner commented 7 years ago

Closing due to lack of activity.

ptrwllrt commented 7 years ago

@CMTegner The described issue fixed itself with the latest smaller updates of the library. Thanks!

CMTegner commented 7 years ago

@cainvommars great! :)