While maybe not a perfect solution, I believe this codepen has an example of how to potentially achieve this https://codepen.io/Algolia/pen/OXgZxv
This part most specifically:
document.querySelector(".searchbox [type='reset']").addEventListener("click", function() {
document.querySelector(".aa-input").focus();
this.classList.add("hide");
myAutocomplete.autocomplete.setVal("");
});
There it deselects the field, modifies the class list, and clears out the value. The myAutocomplete
variable is set on line 3 and that part should look familiar compared to the out of box templates.