I'm trying to implement autocomplete search using algolia, everything works.The algolia autocomplete uses selectize.js plugin to display a form and the dropdown but the problem is if I click the input box it shows the suggestions with one of the suggestions being selected so if I hit enter without typing anything it will automatic choose the first suggestion. What I want is if I type a word or leave it empty and press enter it shouldn't select any of the suggestion. How can I fix this? Any help would be appreciated.
const autocomplete = instantsearch.connectors.connectAutocomplete(
({ indices, refine, widgetParams }, isFirstRendering) => {
const { container, onSelectChange } = widgetParams;
if (isFirstRendering) {
container.html('<select id="ais-autocomplete"></select>');
container.find('select').selectize({
options: [],
valueField: 'id',
labelField: 'name',
highlight: true,
onType: refine,
onBlur() {
refine(this.getValue());
},
score() {
return function() {
return 1;
};
},
onChange(value) {
onSelectChange(value);
refine(value);
},
});
return;
}
const [select] = container.find('select');
indices.forEach(index => {
select.selectize.clearOptions();
index.results.hits.forEach(h => select.selectize.addOption(h));
select.selectize.refreshOptions(select.selectize.isOpen);
});
}
);
]);