WebDevStudios / wp-search-with-algolia

Improve search on your site. Autocomplete is included, along with full control over look, feel and relevance.
https://wordpress.org/plugins/wp-search-with-algolia/
146 stars 55 forks source link

Close button for algolia-autocomplete #349

Closed scesini closed 1 year ago

scesini commented 1 year ago

Any recommendation to add a close button for algolia-autocomplete pop-up? Looks like we can't close the algolia-autocomplete pop-up when has something on the input field. The only way to do this is to delete all the typed text? Can be much better if disappears when clicking outside the algolia-autocomplete pop-up, right? And maybe with a X on the side for mobile devices?

tw2113 commented 1 year ago

If it's something we can control, definitely worth considering. Not sure if this would be something coming from Autocomplete's rendering, or something we'd need to add ourselves.

scesini commented 1 year ago

Hi @tw2113 any idea about how to make it work? Thank you.-

tw2113 commented 1 year ago

Not really off the top of my head, but if anything comes to mind, I will definitely drop it in this issue.

Otherwise it's an open enhancement available to be worked on.

tw2113 commented 1 year ago

@scesini By any chance do you have SCRIPT_DEBUG set to true?

Asking because of the debug line in https://github.com/WebDevStudios/wp-search-with-algolia/blob/main/includes/class-algolia-template-loader.php#L75-L89

If you look at https://github.com/algolia/autocomplete/tree/v0.38.0#global-options which is the Autocomplete version we still ship with at this time, setting debug to true causes: "If true, the autocomplete will not close on blur. Defaults to false."

I've tested this both on desktop and mobile with SCRIPT_DEBUG set to false and the close on blur is working.

scesini commented 1 year ago

@tw2113 You are right. Works with the SCRIPT_DEBUG = false Thank you!