rtfeldman/elm-css

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

Opened this issue · 0 comments

or-n commented
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": {}
    }
}