elm-lang / keyboard

Global keyboard events in Elm

Home Page:http://package.elm-lang.org/packages/elm-lang/keyboard/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Handling preventDefault

mdgriffith opened this issue · comments

I have a project which uses spacebar and backspace as controls, both of which have builtin defaults in the browser that I need to bypass.

Being able to selectively preventDefault on a key-by-key basis would be ideal or in some cases to preventDefault on a conditional basis within elm. e.g. Only preventDefault for a key if the model has a certain state. However at the moment my app doesn't require the latter.

This would be really useful for game development in Elm, since most in-browser games will use keys with default behaviours such as the arrow keys and the spacebar.

@mdgriffith In the meantime you can use Chrome Canary, which no longer have the default behaviour for backspace. This is expected to be shipped in future versions of Chrome.