accessible-autocomplete icon indicating copy to clipboard operation
accessible-autocomplete copied to clipboard

Docs for autoselect are incorrect

Open edwardhorsford opened this issue 5 years ago • 3 comments

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 avatar Sep 24 '20 10:09 edwardhorsford

@edwardhorsford im writing a blog post on this atm with a fix in our branch

matthewford avatar Sep 25 '20 13:09 matthewford

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

matthewford avatar Sep 25 '20 13:09 matthewford

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.enhanceSelectElement function 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 autoselect to true
  • [...]

So I believe the docs are currently correct, even if the behaviour isn't desired.

36degrees avatar Jan 11 '22 16:01 36degrees