This library provides keyboard event functions, similar to the helpers provided in Html.Events.
The core event types this library supports are
keyup. Since it's often necessary to listen for multiple keyboard events on a given form control, the event functions accept a list of listener criteria that map to particular message constructor.
Suppose you have a
<textarea> and you would like to:
Meta + Enteris pressed (on a Mac, the meta key is Command), and
Your program (partially) might look something like this:
import Keys exposing (Modifier(..), KeyboardEvent, preventDefault, onKeydown) type Msg = MetaEnterPressed KeyboardEvent | EscPressed KeyboardEvent view : Html Msg view = textarea [ onKeydown preventDefault [ ( [ Meta ], Keys.enter, MetaEnterPressed ) , ( , Keys.esc, EscPressed ) ] ]  -- Other program details omitted
The first argument is a set of options (see
The second is a list of three-part tuples containing: