Abstract

This document describes the legacy key event properties keyCode and charCode, their values in some common browsers, and how they correspond to the key event property values defined in the DOM Level 3 Events [DOM3 Events] specification.

Status of this Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

Publication as a Working Group Note does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.

Browser support for keyboards has traditionally relied on two ad-hoc event interface properties, keyCode, and charCode. The values for these properties, and the availability of the attribute, is inconsistent across platforms, keyboard languages and layouts, user agents, versions, and even event types. A significant amount of legacy content, including script libraries, relies upon detecting the user agent and acting accordingly, and any changes to keyCode, or charCode risk breaking as much content as they fix or enable. Additionally, these properties are not suitable for international usage, or accessibility concerns. Therefore, the DOM Level 3 Events [DOM3 Events] specification does not normatively define the keyCode, and charCode properties, relying instead only on the more robust key values, which can be used safely and consistently in any user agent which conforms to that specification. However, for the purpose of documenting the current state of these properties and their relation to equivalent key values, this note contains the following table, which is to be used as an informative reference only, and does not document the full range of values for keyCode, and charCode.