On Wednesday, March 4, 2015 at 12:10:07 PM UTC-5, Andrew S wrote:
> Turns out that using onKeyDown instead of onKeyPress worked. The React docs 
> suggest they behave the same, but apparently not so (in Chrome at least).

Browser keyboard handling is definitely quirky, especially if you get into 
cut/copy/paste events. Some things that may be relevant to your situation:

onKeyDown fires whenever a key is pressed, but in some browsers, onKeyPress 
only fires for keys which correspond to a text character, whether alphanumeric, 
symbol, or whitespace.

In OSX Chrome, if a modifier key is down, onkeypress WILL NOT occur, whether or 
not the key combination produces an effect. For instance, Cmd-C will cause the 
Copy behavior, and an oncopy event; Ctrl-C will have no effect, because it is 
not a valid command.

In Safari 7, if a modifier key is down, onkeypress WILL occur, even if the key 
combination is a valid command. Returning false from this handler will prevent 
the command from occurring, which is not the desired behavior.

In Firefox on OSX, the Command key has a keyCode of 224, instead of the 
standard 91. That one had me stumped for quite a while...

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to