Subscribing to keypresses doesn't work in Firefox
croyzor opened this issue · 0 comments
croyzor commented
(Duplicate of #3)
Using Firefox on Linux, subscribing to keypresses using the presses
function always gives a keycode of 0. This issue is demonstrated in using the code below. Subscribing to downs
or ups
gives the expected keycodes.
import Html exposing (..)
import Html.App exposing (program)
import Char exposing (fromCode,toCode)
import Keyboard exposing (..)
type alias Model = List KeyCode
type Msg = KeyMsg KeyCode
init : (Model, Cmd Msg)
init = ([], Cmd.none)
update : Msg -> Model -> (Model, Cmd Msg)
update (KeyMsg msg) m = (msg::m, Cmd.none)
subscriptions : Model -> Sub Msg
subscriptions _ = presses KeyMsg
view : Model -> Html Msg
view m = text (toString m)
main = program {
init = init,
update = update,
view = view,
subscriptions = subscriptions
}