gregziegan / elm-autocomplete

Autocomplete for Elm apps; in Elm
http://package.elm-lang.org/packages/thebritican/elm-autocomplete/latest
BSD 3-Clause "New" or "Revised" License
173 stars 43 forks source link

AccessibleExample clearing selection on non-input key presses #41

Open juanedi opened 7 years ago

juanedi commented 7 years ago

To reproduce in the demo page:

After doing this, the stored value in the model is reset. I believe it may be due to the following code:

        onKeyDown =
            \code maybeId ->
                if code == 38 || code == 40 then
                    Maybe.map PreviewPerson maybeId
                else if code == 13 then
                    Maybe.map SelectPersonKeyboard maybeId
                else
                    Just <| Reset

It can be verified by modifying demo app so that it displays or logs the selected option.

I know this is just a demo, but since it is being suggested as the mostly drop-in solution I believe it should probably be fixed. Spending some time integrating and tuning the example to later find this out is kinda sad.

Great work BTW :)

gregziegan commented 7 years ago

Thanks for reporting! I'll be fixing this with the elm 0.18 release 😄 . Going to write some actual tests to verify the autocomplete works according to ARIA specs as well 😛