elm-autocomplete
elm-autocomplete copied to clipboard
AccessibleExample clearing selection on non-input key presses
To reproduce in the demo page:
- focus on input field
- press a letter
- select any option with the mouse
- press shift, control, caps lock, or any key that doesn't change the input text
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 :)
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 😛