Created
November 6, 2015 01:53
-
-
Save pchiusano/25d53d29414d2f730b1d to your computer and use it in GitHub Desktop.
Overriding the keyboard arrows in a Reflex text box
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
searchbox <- textInput def | |
let isArrow i = i == 38 || i == 40 | |
let tweak e = e >>= \i -> if isArrow i then i <$ preventDefault else pure i | |
tweakedKeydown <- wrapDomEvent (_textInput_element searchbox) elementOnkeydown (tweak getKeyEvent) | |
_ <- widgetHold (pure ()) (fmap (const (pure ())) tweakedKeydown) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
performEvent_ (void tweakedKeydown)