PaackEng / elm-ui-dropdown

Dropdown module for Elm UI
https://package.elm-lang.org/packages/PaackEng/elm-ui-dropdown/latest/
MIT License
20 stars 10 forks source link

Arrow key selection after using a filter dropdown selects the incorrect option #29

Closed peteygao closed 3 years ago

peteygao commented 3 years ago

Elm version 0.19.1 Package version 2.0.0 Browser Vivaldi (Chrome/89.0.4389.116)

This is the list of configs I am using:

      Dropdown.filterable dropdownMsg itemPickedMsg itemToPrompt itemToElement identity
          |> Dropdown.withContainerAttributes containerAttrs
          |> Dropdown.withSelectAttributes selectAttrs
          |> Dropdown.withListAttributes listAttrs
          |> Dropdown.withSearchAttributes searchAttrs

Example scenario

Imagine a dropdown with the following selections in this order:

Chips
Banana
Apple

If you type in a, it will show you both Banana and Apple. If you use the keyboard to press Enter, you will select Chips. If you press arrow down to highlight Apple, and then press Enter, you will select Banana.

It seems like the final selection index is not based on the filtered option, but the literal ordering of the options present in the dropdown.

fmechant commented 3 years ago

We have the same issue. We have looked into the code and made the necessary corrections in pull-request.

Please release this, maybe in version 3.0.1. Is completely backwards compatible.