jjagielka / select-menu / Menu.FocusList

Manage focus changes through the list of sibilings.

Types


type alias FocusList =
String

The only value needed to be stored is the unique identifier used to set focus.


type Item msg
    = Anchor (( String, List (Html.Attribute msg), List (Html msg) ))
    | Button (( String, List (Html.Attribute msg), List (Html msg) ))

List item types. Html link or button.


type Msg

Internal module messages.

TEA

update : Msg -> FocusList -> Platform.Cmd.Cmd Msg

Standard update function.

view : FocusList -> List (Item msg) -> List (Html msg)

Renders the list.

Events

trigger : (Msg -> msg) -> Html.Attribute msg

Html.Attribute that causes the selection of the first elment in the list.

onSelect : (String -> msg) -> FocusList -> Html.Attribute msg

Catches the selection.

onKeyDown : String -> (Msg -> msg) -> Html.Attribute msg

Html.Attribute to handle navigation keys.

div [ onKeyDown FocusListMsg ]
    [ FocusList.view list children
    ]