equinor/design-system

Autocomplete single select highlight will not reflect programatically set `selectedOptions`

eskildht opened this issue ยท 1 comments

Describe the bug

Setting selectedOptions externally i.e. not by interacting with the autocomplete itself e.g. clicking a button, after an initial selection have been made, will result in the Autocomplete component reflecting the newly selected option text, but not update the selected highlight.

Steps to reproduce the bug

Using codesandbox

  1. Click autocomplete and select "option 4"
  2. Click autocomplete and see that "option 4" is highlighted as selected
  3. Click button "Change to random other option"
  4. Click autocomplete and see that "option 4" is still highlighted as selected even though another option has been selected as reflected by the Autocomplete text

Video

autopt.mov

Expected behavior

Selected highlight follows selectedOptions (option) for single select.

Specifications

  • Version: eds-core-react 0.41.3
  • Browser: chrome
  • OS: macOS

Additional context

A bit on the side, but somewhat related/workaround; if using multiselect (multiple prop) this is not a problem as there is no highlight and the checkboxes correctly reflect selectedOptions.

This was indeed a bug. I have published a new release with a fix ๐Ÿ˜ƒ๐Ÿ‘