Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open list on focus problems #332

Open
Joanzo opened this issue Mar 28, 2022 · 3 comments
Open

Open list on focus problems #332

Joanzo opened this issue Mar 28, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@Joanzo
Copy link

Joanzo commented Mar 28, 2022

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

@Joanzo Joanzo added the bug Something isn't working label Mar 28, 2022
@Ezra-Siton-UIX
Copy link

Ezra-Siton-UIX commented Apr 18, 2022

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

@LucasRoquilly
Copy link

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.

@adriandmitroca
Copy link

events: {
  input: {
    focus: () => {
      autoCompleteJS.open();
    },
  },
},

is enough to reopen search results after focusing the input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants