Skip to content
This repository has been archived by the owner on Aug 23, 2018. It is now read-only.

Keyboard.presses always returns code 0 #10

Open
christianp opened this issue Feb 9, 2018 · 0 comments
Open

Keyboard.presses always returns code 0 #10

christianp opened this issue Feb 9, 2018 · 0 comments

Comments

@christianp
Copy link

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]
xurtis added a commit to xurtis/nsa-crypto that referenced this issue Feb 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant