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

Add li position index to li function in View.Config #45

Closed frenchdonuts closed 7 years ago

frenchdonuts commented 7 years ago

Hello, this feature would be useful to me in the following example:

        customLi keySelected mouseSelected i data =
            { attributes =
                [ attribute "aria-posinset" (toString i)
                , attribute "aria-setsize" (List.length dataList)
                , attribute "role" "option"
                ]
            , children = [ text (dataToString data) ]
            }

which would would allow assistive technologies(AT) like Mac's VoiceOver(VO) to read a list of items along with the index of the current item.

For example, if we have a list of foods:

  1. Pizza (upon selection, VO would read "Pizza, 1 of 3")
  2. Burger (upon selection, VO would read "Burger, 2 of 3")
  3. Chickpeas (upon selection, VO would read "Chickpeas, 3 of 3")

This way, the user of AT always knows where they are in the list.

frenchdonuts commented 7 years ago

So I finally got my fork working, but VO still wasn't reading "{position in list} of {size of set}". It turns out you don't have to set these ARIA attributes if the only li elements present are the filtered ones. Since I no longer need this feature, I'll close this issue.