Keyboard.presses always returns code 0
christianp opened this issue · comments
I've just been playing in Firefox 58, and Keyboard.presses
always produces the KeyCode 0, no matter what key is pressed.
Keyboard.ups
produces the right codes.
Here's a small example (on Ellie):
import Html exposing (..)
import Keyboard exposing (KeyCode, presses)
main =
Html.program
{ init = init
, view = view
, update = update
, subscriptions = subscriptions
}
-- MODEL
type alias Model = Maybe KeyCode
init : ( Model, Cmd Msg )
init =
( Nothing, Cmd.none )
-- UPDATE
type Msg
= SetCode KeyCode
update : Msg -> Model -> ( Model, Cmd Msg )
update (SetCode code) model = (Just code, Cmd.none)
-- SUBSCRIPTIONS
subscriptions : Model -> Sub Msg
subscriptions model = presses SetCode
-- VIEW
view model = div [] [text <| toString model]