In my autocomplete item template, I would like to include an additional numeric input alongside an “add to cart” button for each search result to provide a more seamless user experience when browsing our site.
The issue I’m having is that as soon as I try to set focus to the input field, the autocomplete panel closes and it’s impossible to enter a value.
A bit of research found this previous question where a member of the Algolia team suggested using e.preventDefault()
in the onSelect
event which does prevent the panel from closing but also prevents the input field from getting focus.
I have also seen other suggestions about setting the debug
parameter when initialising the autocomplete widget but that does not work either.
Does anyone have any suggestions on how to achieve this behaviour? Everything I’ve tried hasn’t worked so far and not been able to find anything useful in the docs to give me an idea of what direction to take to make this work.