Key Events

Strategy: normalize to Mozilla as much as possible

The onkeypress event appears to return the most reliable keyboard data in general. IE does not fire keypress for most non-printable keys so we patch IE to simulate keypress events.

Rule: rely on keypress

keyCode for non-printable keys can vary by browser and platform. Use dojo.keys constants to test for a specific keyCode instead of hardcoded values.

Rule: use dojo.keys

We normalize to the Mozilla convention where charCode has a value for printable keys, and keyCode has a value for non-printable keys. We also introduce a proprietary String property keyChar, which is the string corresponding to charCode (or '').

Normalizations

Testing Notes

General Notes