autoComplete.js
autoComplete.js copied to clipboard
Open list on focus problems
https://tarekraafat.github.io/autoComplete.js/#/how-to-guides?id=open-list-on-focus Open list on focus example is not working.
if try from recommendation using space on focus setting. events: { input: { focus() => autoCompleteJS.start(" "); }, },
it will not work on search Engine "strict" mode. While it's working on "loose" mode. i.e: This is not working if there's no space in the list. i.e: [ "Apple", --> this will NOT be shown, "Banana Orange" --> will be shown ]
We don't want to change the searchEngine to "loose" mode as it return weird results.
How to solve this? Thanks
The demo not working anyway (The list do not Open list on focus).
This code works for me:
focus: (event) => {
console.log("Input Field in focus!");
const inputValue = autoCompleteJS.input.value;
autoCompleteJS.start();
autoCompleteJS.open();
},
This codepen example also working: https://codepen.io/tarekraafat/details/RwKQobg
Hello,
The code given by @Ezra-Siton-UIX did not work for me and the codepen provided seems to be an old version of Autocomplete.js.
I have managed to open the list on focus to display all results by adding :
trigger: (query) => { return true }
and
focus: (event) => { search_autoComplete.start(); }
To the config options.
Result list is still limited by maxResults
.
Working Codepen here : https://codepen.io/lucasroquilly/pen/LYQdpXB
I think documentation should be updated to give a working example.
events: {
input: {
focus: () => {
autoCompleteJS.open();
},
},
},
is enough to reopen search results after focusing the input