accessible-autocomplete
                                
                                 accessible-autocomplete copied to clipboard
                                
                                    accessible-autocomplete copied to clipboard
                            
                            
                            
                        Docs for autoselect are incorrect
The docs state that autoselect defaults to false - this does not appear to be the case at least for the accessibleAutocomplete.enhanceSelectElement() method is used - the feature is on by default.
This is problematic as autoselect is basically incompatible with show all values and causes usability issues.
@edwardhorsford im writing a blog post on this atm with a fix in our branch
Our branch https://github.com/alphagov/accessible-autocomplete/compare/master...bitzesty:select-behaviour
And a blog post on some of the changes we made. Once we rebase and update the docs we will raise a PR.
https://twitter.com/bitzesty/status/1309503796813484032
It looks like the default value for autoselect is false:
https://github.com/alphagov/accessible-autocomplete/blob/d617d5f0c60871ad9e0a3000ce8802edad749e92/src/autocomplete.js#L39
However, enhanceSelectElement specifically enables it (unless it's passed in as an option):
https://github.com/alphagov/accessible-autocomplete/blob/d617d5f0c60871ad9e0a3000ce8802edad749e92/src/wrapper.js#L45
It currently says that it will do this in the README as well:
You can use the
accessibleAutocomplete.enhanceSelectElementfunction to enhance it into an autocomplete:accessibleAutocomplete.enhanceSelectElement({ selectElement: document.querySelector('#location-picker') })This will:
- Place an autocomplete input field after the specified
<select>- Default the autocomplete
autoselecttotrue- [...]
So I believe the docs are currently correct, even if the behaviour isn't desired.