TarekRaafat / autoComplete.js

Simple autocomplete pure vanilla Javascript library.
https://tarekraafat.github.io/autoComplete.js
Apache License 2.0
3.93k stars 236 forks source link

getting "e.feedback.results is undefined" when calling select() #407

Open nicolasmoreau opened 1 year ago

nicolasmoreau commented 1 year ago

Hello,

When I use the select() function from the API I got the following error : Uncaught TypeError: e.feedback.results is undefined

The error can be reproduced from https://codepen.io/tarekraafat/pen/rQopdW?editors=1111 , by modifying :

events: {
    input: {
        focus: () => {
            if (autoCompleteJS.input.value.length) autoCompleteJS.start();
        }
    }
}

and replacing it by :

events: {
    input: {
        focus: () => {
            autoCompleteJS.select(1);
        }
    }
}

The error occur when the search input element get the focus when the user click in it.