Vanilla JS Accessible Autocomplete
What is an Auto Suggest?
Autosuggest, also referred to semantically as a Combobox, is a web component we are all familiar with. It is comprised of an input where a user can type, and a dropdown menu with suggestions that the user can select. Depending on the use case, there may be some extra caveats. Some components will autofill the user's response based on the suggests, some will require that the user select something, some will fire a network request and so on.
A component such as this is pervasive in the modern web, search boxes, form inputs, and so many things utilize a variation of this component. It is a wonder that there isn't a standard HTML element to handle them.
This project shows a complete Vanilla JS approach to making such a component while maintaining accessiblity. Please read the full blog post to understand the approach used.