Adds some very basic autocomplete functionalities to our main search input. It returns results for what has been typed so far for products and taxons, up to 5 for each type.
For products, it also allows users to see all results for the given keyword, falling back to the standard search.
Once the suggestions box appears, some very basic UX allows to navigate results:
Key down: go to the next result.
Key up: go to the previous results.
Enter: open the currently selected result.
Esc: close the suggestions box.
Click anywhere else on the page: close the suggestions box.
Thanks @elia for guidance and help during its development.
Description
This feature uses stimulus to submit the form on every key pressed in the search input (if > 2 chars) and add some UX to navigate the results.
Turbo stream will take care of updating the results section with the suggestions retrieved from the new specific controller action introduced.
Motivation and Context
We want to provide a basic implementation for stores that want to add autocomplete capabilities to their store. This solution is basic but highly customizable based on each store's specific needs.
How Has This Been Tested?
Tested manually and via specs (see PR changes).
Types of changes
[ ] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
Checklist:
[x] My code follows the code style of this project.
[ ] My change requires a change to the documentation.
Adds some very basic autocomplete functionalities to our main search input. It returns results for what has been typed so far for products and taxons, up to 5 for each type.
For products, it also allows users to see all results for the given keyword, falling back to the standard search.
Once the suggestions box appears, some very basic UX allows to navigate results:
Thanks @elia for guidance and help during its development.
Description
This feature uses stimulus to submit the form on every key pressed in the search input (if > 2 chars) and add some UX to navigate the results.
Turbo stream will take care of updating the results section with the suggestions retrieved from the new specific controller action introduced.
Motivation and Context
We want to provide a basic implementation for stores that want to add autocomplete capabilities to their store. This solution is basic but highly customizable based on each store's specific needs.
How Has This Been Tested?
Tested manually and via specs (see PR changes).
Types of changes
Checklist: