algoliasearch-netlify icon indicating copy to clipboard operation
algoliasearch-netlify copied to clipboard

Hitting Enter/Return on search form does nothing

Open atn38 opened this issue 4 years ago • 2 comments

Hello Algolia team,

It seems to me that the Algolia front-end bundle does not generate a conventional search results page, and replaces it with the instant search feature. I'm a fan. However, hitting Enter/Return after typing in keywords on search form does nothing, which I suspect might be un-intuitive to users. Is this the desired behavior? For example, I imagine hitting enter could (1) go to the first result or (2) leave a "no results" message.

Thanks!

atn38 avatar Dec 18 '20 15:12 atn38

Seems to be the default behaviour of Autocomplete V1 and Docsearch, any reason why and suggestion on this @francoischalifour?

bodinsamuel avatar Dec 18 '20 16:12 bodinsamuel

@atn38 IIUC, you'd like to have the first result selected by default so that hitting Enter redirects to the first link? (In other terms, never have no items selected).

To achieve this, you can use the defaultSelectedItemId option (that'll be called defaultActiveItemId in the next version) set to 0.

If you only wish to catch the submit form event, you can use the onSubmit param.

francoischalifour avatar Dec 23 '20 11:12 francoischalifour