Finish sections on non-standard keyboards.
authorGary Kacmarcik <garykac@google.com>
Fri, 25 Jan 2013 17:04:01 -0800
changeset 20 2689509b37a6
parent 19 748a6d8941b2
child 21 5f9f5a256e18
Finish sections on non-standard keyboards.
source_respec.htm
--- a/source_respec.htm	Fri Jan 25 15:10:42 2013 -0800
+++ b/source_respec.htm	Fri Jan 25 17:04:01 2013 -0800
@@ -477,7 +477,7 @@
             </section>
 
             <pre class="example">
-            <p class="example-title">Handling the Left and Right 'Alt' Keys
+            <p class="example-title">Handling the Left and Right Alt Keys
             </p><table class="data-table">
                 <thead><tr><th>Keyboard Layout</th><th><code>char</code></th><th><code>key</code></th><th><code>code</code></th><th>Notes</th></tr></thead>
                 <tbody>
@@ -492,7 +492,7 @@
             </p><p class="example-text">Note that, with the French layout, the location for the Alt and AltGr keys is <code class="constant-name">DOM_KEY_LOCATION_STANDARD</code> since there
                is only one of each key. 
             </p>
-            </pre>
+            </pre><!-- Handling Left and Right Alt Keys -->
 
             <pre class="example">
             <p class="example-title">Handling the Single Quote Key
@@ -508,7 +508,7 @@
               <code>key</code> values vary based on the current locale, whereas the <code>code</code> attribute
               returns a consistent value.
             </p>
-            </pre>
+            </pre><!-- Handling the Single Quote Key -->
 
             <pre class="example">
             <p class="example-title">Handling the '2' Key (with and without Shift pressed)
@@ -527,7 +527,7 @@
               Regardless of the current locale or the modifier key state, pressing the key labelled <code class="keycap">2</code>
               on a US keyboard always results in <code class="key-code">'Digit2'</code> in the <code>code</code> attribute. 
             </p>
-            </pre>
+            </pre><!-- Handling the 2 Key -->
 
             <pre class="example">
             <p class="example-title">Sequence of Keyboard Events : Shift and '2'
@@ -559,11 +559,11 @@
                     <tr><td>US</td><td>keyup</td><td><code class="glyph">'2'</code></td><td><code class="key-code">'2'</code></td><td><code class="key-code">'Digit2'</code></td><td></td></tr>
                 </tbody>
             </table><p class="example-text">
-              Note that the values contained in the <code>char</code> and <code>key</code> attributes do match between
+              Note that the values contained in the <code>char</code> and <code>key</code> attributes do not match between
               the keydown and keyup events for the '2' key. The <code>code</code> attribute provides a consistent value
               that is not affected by the current modifier state.
             </p>
-            </pre>
+            </pre><!-- Sequence of Keyboard Events: Shift and 2 -->
 
         </section>
 
@@ -1027,7 +1027,7 @@
                             <tr><td><code id="code-Numpad7" class="key-code">'Numpad7'</code></td>
                                 <td>0x5f</td><td><code class="keycap">7</code> and <code class="keycap">Home</code></td></tr>
                             <tr><td><code id="code-Numpad8" class="key-code">'Numpad8'</code></td>
-                                <td>0x60</td><td><code class="keycap">8</code> and <code class="keycap">ArrowUp<code></td></tr>
+                                <td>0x60</td><td><code class="keycap">8</code> and <code class="keycap">ArrowUp</code></td></tr>
                             <tr><td><code id="code-Numpad9" class="key-code">'Numpad9'</code></td>
                                 <td>0x61</td><td><code class="keycap">9</code> and <code class="keycap">PageUp</code></td></tr>
                             <tr><td><code id="code-NumpadAdd" class="key-code">'NumpadAdd'</code></td>
@@ -1228,23 +1228,80 @@
             </section><!-- keyboard-key-codes -->
         </section><!-- keyboards -->
 
-        <section id="remote-controls">
-            <h1>Remote Controls</h1>
-            <p>*** TODO
+        <section id="non-keyboards">
+            <h1>Non-Standard Keyboards and Other Input Devices</h1>
+            <p>This section briefly describes how key input from non-standard keyboards and other
+               input devices should be handled with respect to the <code>code</code> attribute.
             </p>
-        </section><!-- remote-controls -->
+            <p>In general, these devices do not suffer from the complications found on 
+               found on standard PC computers (modifier keys and support for multiple input layouts)
+               so the <code>code</code> attribute can be duplicated from the <code>key</code>
+               attribute or left empty.
+            </p>
 
-        <section id="virtual-keyboards">
-            <h1>Virtual Keyboards</h1>
-            <p>*** TODO
-            </p>
-        </section><!-- virtual-keyboards -->
+            <section id="remote-controls">
+                <h1>Media Remote Controls</h1>
+                <p>Remote controls for media devices typically consist of a set of buttons that are used to directly
+                   control media functions on the device. These remote control buttons typically do not
+                   have modifier states so each button is assigned a single function (like "Play", "Pause",
+                   "Up", "Menu" or "Exit").
+                </p>
+                <p>This simple arrangement where each button has one function means that the
+                   <code>code</code> attribute will usually be exactly the same as the <code>key</code>
+                   attribute for that button. It is only if the remote control has a mechanism
+                   (like the "2nd" function button on a calculator) that allows buttons to produce
+                   alternate <code>key</code> values that the <code>code</code> value will differ from
+                   the <code>key</code> value.
+                   In this case, the value of the <code>code</code> attribute should always be the value
+                   that the button would produce when in its factory-reset condition.
+                </p>
+            </section><!-- remote-controls -->
 
-        <section id="other-devices">
-            <h1>Other Devices</h1>
-            <p>*** TODO
-            </p>
-        </section><!-- other-devices -->
+            <section id="virtual-keyboards">
+                <h1>Virtual Keyboards</h1>
+                <p>When a virtual keyboard is trying mimicking the layout and functionality of a standard
+                   keyboard, then it should also set the <code>code</code> attribute as appropriate.
+                   However, most virtual keyboards only copy the layout of the core writing system keys.
+                   Virtual keyboards that fall into this category can safely ignore the <code>code</code>
+                   attribute (by leaving is empty).
+                </p>
+            </section><!-- virtual-keyboards -->
+
+            <section id="chording-keyboards">
+                <h1>Chording Keyboards</h1>
+                <p>A chording keyboard is a keyboard with a small number of physical keys that requires
+                   the user to hold a number of keys simultaneously
+                   (or press them in sequence) to produce a single key input event. The advantage of chording
+                   keyboards is that they require a small number of distinct keys and can usually be
+                   operated with a single hand.
+                </p>
+                <p>If implemented properly, the system should be unaware that the user is entering text
+                   using a chording keyboard, so the code that translates the chord combinations to
+                   regular key events should fabricate appropriate <code>code</code> values.
+                </p>
+            </section><!-- chording-keyboards -->
+
+            <section id="other-devices">
+                <h1>Other Devices</h1>
+                <p>Other devices that generate key events should be supported in the manner described above
+                   in the [<a href="#remote-controls">Media Remote Controls</a>] section:
+                </p>
+                <ul>
+                    <li>If the button or key always produces the same <code>key</code> value, then the
+                        <code>code</code> should simply be duplicated from the <code>key</code>.
+                    </li>
+                    <li>If the button of key can produce different <code>key</code> values based on some
+                        modifier state, then the <code>code</code> value should be the <code>key</code> value
+                        generated when the button is pressed while the device is in its factory-reset state.
+                    </li>
+                </ul>
+                <p>When there isn't an appropriate <code>code</code> value already defined and a new
+                   value needs to be chosen, the string value should be constructed so that descriptive
+                   (avoid names that are ambiguous or too short) and wherever possible, related buttons
+                   should share a common prefix (like the Numpad keys). 
+                </p>
+            </section><!-- other-devices -->
+        </section><!-- keyboards -->
         
     </section><!-- keyboard-events -->