Closed kafeltz closed 6 years ago
That's amazing, thank you, will review asap.
I will also add a test case if it is missing, so don't worry much about it.
I wonder about this kind of fix, I thought the selector id should have come right from the function parameter. Anyway, the issue is const slug
is undefined
because the index is 1 and options is 0.
I eventually came up with choosing the first element in the drop-down if we are out of range. Not the 100% best approach but it was an edge case in the first place
Steps to reproduce the bug:
1- access the demo page https://yury-dymov.github.io/react-autocomplete-input/
2- type
@ap
and press ARROW DOWN, theapricot
will be selected (highlighted)3- press
ple
(completing apple word), it will show onlyapple
in the list, but not selected4- press enter (without selecting apple) It will show
@undefined
I know the problem.
this.state.selection
is 1 when there is 0 in options.I'm seding PR to fix that. Take a look.