Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: simple ohanhi/keyboard example not working on Brave/Firefox, but Chromium #525

Open
or-n opened this issue Aug 29, 2020 · 0 comments
Open

Comments

@or-n
Copy link

or-n commented Aug 29, 2020

module Main exposing (..)

import Browser exposing (element)
import Html.Styled exposing (Html, text, div, toUnstyled)
import Keyboard exposing (Key(..))

main : Program () (List Key) Keyboard.Msg
main = element
    { init = \_ -> ([], Cmd.none)
    , view = view >> toUnstyled
    , update = update
    , subscriptions = \_ -> Keyboard.subscriptions
    }

view pressed_keys =
    let
        control_msg =
            if List.member Control pressed_keys then
                "Control"
            else
                "No Control"
        space_msg =
            if List.member Spacebar pressed_keys then
                "Space"
            else
                "No Space"
    in
        div []
            [ div [] [text control_msg]
            , div [] [text space_msg]
            ]

update msg pressed_keys =
    let (new_pressed_keys, _) =
            Keyboard.updateWithKeyChange
                Keyboard.anyKeyOriginal
                msg
                pressed_keys
    in 
        (new_pressed_keys, Cmd.none)

No change after pressing Control.
Replacement of Control text by Space text after pressing Space.

Operating system: Ubuntu 20.04

elm.json:

{
    "type": "application",
    "source-directories": [
        "src"
    ],
    "elm-version": "0.19.1",
    "dependencies": {
        "direct": {
            "elm/browser": "1.0.2",
            "elm/core": "1.0.5",
            "elm/html": "1.0.0",
            "ohanhi/keyboard": "2.0.1",
            "rtfeldman/elm-css": "16.0.2"
        },
        "indirect": {
            "Skinney/murmur3": "2.0.8",
            "elm/json": "1.1.3",
            "elm/time": "1.0.0",
            "elm/url": "1.0.0",
            "elm/virtual-dom": "1.0.2",
            "rtfeldman/elm-hex": "1.0.0"
        }
    },
    "test-dependencies": {
        "direct": {},
        "indirect": {}
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant