more explanation of key event states and key identifiers
authorschepers
Thu, 17 Sep 2009 15:58:24 +0900
changeset 202 7a29a6b953f8
parent 201 872ee0aa5b6a
child 203 a542b7bd3a54
more explanation of key event states and key identifiers
html/DOM3-Events.html
--- a/html/DOM3-Events.html	Thu Sep 17 14:59:09 2009 +0900
+++ b/html/DOM3-Events.html	Thu Sep 17 15:58:24 2009 +0900
@@ -164,7 +164,7 @@
       <dl>
         <dt>This version:</dt>
         <dd>
-          <a href="http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html?rev=1.87">http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html?rev=1.87</a>
+          <a href="http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html?rev=1.88">http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html?rev=1.88</a>
         </dd>
         <dt>Latest stable version:</dt>
         <dd>
@@ -172,7 +172,7 @@
         </dd>
         <dt>Previous version:</dt>
         <dd>
-          <a href="http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html?rev=1.86">http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html?rev=1.86</a>
+          <a href="http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html?rev=1.87">http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html?rev=1.87</a>
         </dd>
         <dt>Editor's Draft:</dt>
         <dd>
@@ -4238,7 +4238,7 @@
             
             <p>It is important to note that a key identifier does not indicate a specific key on the physical keyboard, nor does it reflect the character printed on the key; a key identifier indicates the current value of the event with consideration to the current state of all active keys and key input modes (including shift modes and <a class="def" href="#glossary-dead-key">dead keys</a>), as reflected in the operating-system mapping of the keyboard and reported to the implementation.  In other words, the key identifier for the key marked <code>'O'</code> on a <a class="def" href="#glossary-qwerty">QWERTY</a> keyboard has the key identifier <code>'o'</code> in an unshifted state, <code>'O'</code> in a shifted state, <code>'ö'</code> in an unshifted state during a dead-key operation to add an umlaut diacritic, and <code>'Ö'</code> in a shifted state during a dead-key operation to add an umlaut diacritic.  Because a user may map their keyboard to an arbitrary custom configuration, the author should not assume that a relationship exists between the shifted and unshifted states of a key and the majuscule form (uppercase or capital letters) and minuscule form (lowercase or small letters) of a character representation, but should instead use the value of the <a href="#events-Events-KeyboardEvent-keyIdentifier"><code>KeyboardEvent.keyIdentifier</code></a> property.  The keyboard depicted in Figure 3 illustrates one possible set of key mappings on one possible keyboard layout; many others exist, both standard and idiosyncratic.</p>
             
-            <p>It is also important to note that a given key event state may have multiple key identifiers: the key identifier name; the Unicode value; and the character representation itself.  or example, the question mark key has the following key identifiers: <code>'?'</code> (the character); <code>'QuestionMark'</code> (the name); and <code>'U+003F'</code> (the Unicode value).  Note that not all keys will have all these identifiers; for example, the horizontal tabulation (tab) key has a name (<code class="value">'Tab'</code>) and a Unicode value (<code class="value">'U+0009'</code>) but no character representation, the <code>A</code> key has a character representation (<code class="value">'A'</code>) and a Unicode value (<code class="value">'U+0041'</code>) but no name, and the volume mute key has only a name, <code class="value">'VolumeMute'</code>. <span class="issue">@@ Should there always be a name for a key?  The Unicode name for <code class="value">'A'</code> is "LATIN CAPITAL LETTER A"... should the name be the case-insensitive (or camelcased) Unicode name with no spaces (<code class="value">'LatinCapitalLetterA'</code>) or just the character (<code class="value">'A'</code>)?</span></p>
+            <p>It is also important to note that there is not a one-to-one relationship between key event states and key identifiers.  A particular key identifier may be associated with multiple keys; for example, many standard keyboards contain more than one key with the <code class="value">'Shift'</code> key identifier (normally distinguished by the <a href="#events-Events-KeyboardEvent-keylocation"><code>KeyboardEvent.keyLocation</code></a> values <a href="#events-DOM_KEY_LOCATION_LEFT"><code class="constant-name">DOM_KEY_LOCATION_LEFT</code></a> and <a href="#events-DOM_KEY_LOCATION_RIGHT"><code class="constant-name">DOM_KEY_LOCATION_RIGHT</code></a>) or <code class="value">'8'</code> key identifier (normally distinguished by the <a href="#events-Events-KeyboardEvent-keylocation"><code>KeyboardEvent.keyLocation</code></a> values <a href="#events-DOM_KEY_LOCATION_STANDARD"><code class="constant-name">DOM_KEY_LOCATION_STANDARD</code></a> and <a href="#events-DOM_KEY_LOCATION_NUMPAD"><code class="constant-name">DOM_KEY_LOCATION_NUMPAD</code></a>), and user-configured custom keyboard layouts may duplicate any key identifier in multiple key-state scenarios (note that <a href="#events-Events-KeyboardEvent-keylocation"><code>KeyboardEvent.keyLocation</code></a> is intended for standard keyboard layouts, and cannot always indicate a meaningful distinction).  Similarly, a given key event state may have multiple key identifiers: the key identifier name; the Unicode value; and the character representation itself.  For example, the question mark key has the following key identifiers: <code>'?'</code> (the character); <code>'QuestionMark'</code> (the name); and <code>'U+003F'</code> (the Unicode value).  Note that not all keys will have all these identifiers; for example, the horizontal tabulation (tab) key has a name (<code class="value">'Tab'</code>) and a Unicode value (<code class="value">'U+0009'</code>) but no character representation, the <code>A</code> key has a character representation (<code class="value">'A'</code>) and a Unicode value (<code class="value">'U+0041'</code>) but no name, and the volume mute key has only a name, <code class="value">'VolumeMute'</code>. <span class="issue">@@ Should there always be a name for a key?  The Unicode name for <code class="value">'A'</code> is "LATIN CAPITAL LETTER A"... should the name be the case-insensitive (or camelcased) Unicode name with no spaces (<code class="value">'LatinCapitalLetterA'</code>) or just the character (<code class="value">'A'</code>)?</span></p>
 
               <p>The value of the <a href="#events-Events-KeyboardEvent-keyIdentifier"><code>KeyboardEvent.keyIdentifier</code></a> property of the <a href="#events-Events-KeyboardEvent">KeyboardEvent</a> interface event types (e.g. <a class="eventtype" href="#event-type-keydown"><code>keydown</code></a>, <a class="eventtype" href="#event-type-keypress"><code>keypress</code></a>, and <a class="eventtype" href="#event-type-keyup"><code>keyup</code></a>) must default to the character itself; if the key identifier does not have a character representation, the value of the <a href="#events-Events-KeyboardEvent-keyIdentifier"><code>KeyboardEvent.keyIdentifier</code></a> property must be the Unicode value; if no Unicode value for the key identifier exists, the value of the <a href="#events-Events-KeyboardEvent-keyIdentifier"><code>KeyboardEvent.keyIdentifier</code></a> property must be the key identifier name.  <span class="issue">@@ Should there always be a name for a key?  The Unicode name for <code class="value">'A'</code> is "LATIN CAPITAL LETTER A"... should there be a <code>convertKeyIdentifier</code> method of to allow the author to find either the name, character representation, or Unicode value of any given key identifier?</span></p>