Skip to content

Extra helpers for handling multiple key combinations on html nodes.

License

Notifications You must be signed in to change notification settings

amaksimov/elm-multikey-handling

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

elm-multikey-handling

Extra helpers for handling multiple key combinations on html nodes.

Usage

Just add the attribute to the html node

  div [ class "input-wrapper" ]
      [ input [ type_ "text"
              , id "new-item-input"
              , placeholder "Type item name"
              , onBlur (ItemInput Nothing)
              , onInput (\x -> ItemInput (Just x))
              , defaultKeyHandler
                  |> whenEnter (CreateItemClick boardName)
                  |> whenEscape (Iteam Nothing)
                  |> onKeydown
              ]
              [ text itemName ]

You can use whenKeydown when dealing with buttons without predefined decoders.

  defaultKeyHandler
    |> whenKeydown 13 (CreateItemClick boardName)
    |> onKeydown

About

Extra helpers for handling multiple key combinations on html nodes.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages