Looks like there's a community package elm-lang/keyboard: 
http://package.elm-lang.org/packages/elm-lang/keyboard/latest

I'll give that a try.

On Wednesday, February 1, 2017 at 11:23:31 PM UTC-8, Lyle Kopnicky wrote:
>
> Hi folks,
>
> I'm having trouble detecting keypresses in Elm 0.18. The only examples I 
> can find are old ones that use Signals. There are no examples in the Elm 
> Architecture Tutorial. The Html.Events module documentation shows a piece 
> of the puzzle with the example for onKeyUp.
>
> Heres a gist with the code: 
> https://gist.github.com/anonymous/5f54c2b2c8fb42a31d4ae37058a72e2a
>
> You can ignore the KaTeX import - that's not used at the moment.
>
> It compiles and runs, but the circle just sits there. I have know way of 
> knowing if it's detecting my keypresses. I thought that by putting the 
> event handler on the outer div, it would intercept keypresses. I didn't 
> have any way of adding handler to the svg element.
>
> BTW I also tried 'keyup' instead of 'keypress', and I tried making it 
> generate the MoveRight message for any key, just to make sure it wasn't bad 
> key code problem.
>
> Do I need to somehow attach the keypress handler to the document instead? 
> Perhaps I need to use a subscription? I'm not finding any guidance in the 
> docs. Any help would be appreciated.
>
> Thanks,
> Lyle
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to