[html5] r6773 - [e] (0) Add examples for accessKeyLabel Fixing http://www.w3.org/Bugs/Public/sho [...]

whatwg at whatwg.org whatwg at whatwg.org
Thu Oct 27 13:51:14 PDT 2011


Author: ianh
Date: 2011-10-27 13:51:12 -0700 (Thu, 27 Oct 2011)
New Revision: 6773

Modified:
   complete.html
   index
   source
Log:
[e] (0) Add examples for accessKeyLabel
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=13902

Modified: complete.html
===================================================================
--- complete.html	2011-10-27 20:27:22 UTC (rev 6772)
+++ complete.html	2011-10-27 20:51:12 UTC (rev 6773)
@@ -72156,7 +72156,49 @@
   returns a string representing the actual key combination assigned by
   the user agent.</p>
 
+  <div class=example>
 
+   <p>In this example, an author has provided a button that can be
+   invoked using a shortcut key. To support full keyboards, the author
+   has provided "C" as a possible key. To support devices equipped
+   only with numeric keypads, the author has provided "1" as another
+   possibly key.</p>
+
+   <pre><input type=button value=Collect onclick="collect()"
+       <strong>accesskey="C 1"</strong> id=c></pre>
+
+  </div>
+
+  <div class=example>
+
+   <p>To tell the user what the shortcut key is, the author has 
+   this script here opted to explicitly add the key combination to the
+   button's label:</p>
+
+   <pre>function addShortcutKeyLabel(button) {
+<strong>  if (button.accessKeyLabel != '')
+    button.value += ' (' + button.accessKeyLabel + ')';</strong>
+}
+addShortcutKeyLabel(document.getElementById('c'));</pre>
+
+   <p>Browsers on different platforms will show different labels, even
+   for the same key combination, based on the convention prevalent on
+   that platform. For example, if the key combination is the Control
+   key, the Shift key, and the letter C, a Windows browser might
+   display "<samp>Ctrl+Shift+C</samp>", whereas a Mac browser might
+   display "<samp>^⇧C</samp>", while an Emacs browser might
+   just display "<samp>C-C</samp>". Similarly, if the key combination
+   is the Alt key and the Escape key, Windows might use
+   "<samp>Alt+Esc</samp>", Mac might use
+   "<samp>⌥⎋</samp>", and an Emacs browser might use
+   "<samp>M-ESC</samp>" or "<samp>ESC ESC</samp>".</p>
+
+   <p>In general, therefore, it is unwise to attempt to parse the
+   value returned from the <code title=dom-accessKeyLabel><a href=#dom-accesskeylabel>accessKeyLabel</a></code> IDL attribute.</p>
+
+  </div>
+
+
   <h4 id=the-accesskey-attribute><span class=secno>8.4.2 </span>The <dfn title=attr-accesskey><code>accesskey</code></dfn> attribute</h4>
 
   <p>All <a href=#html-elements>HTML elements</a> may have the <code title=attr-accesskey><a href=#the-accesskey-attribute>accesskey</a></code> content attribute set. The

Modified: index
===================================================================
--- index	2011-10-27 20:27:22 UTC (rev 6772)
+++ index	2011-10-27 20:51:12 UTC (rev 6773)
@@ -72156,7 +72156,49 @@
   returns a string representing the actual key combination assigned by
   the user agent.</p>
 
+  <div class=example>
 
+   <p>In this example, an author has provided a button that can be
+   invoked using a shortcut key. To support full keyboards, the author
+   has provided "C" as a possible key. To support devices equipped
+   only with numeric keypads, the author has provided "1" as another
+   possibly key.</p>
+
+   <pre><input type=button value=Collect onclick="collect()"
+       <strong>accesskey="C 1"</strong> id=c></pre>
+
+  </div>
+
+  <div class=example>
+
+   <p>To tell the user what the shortcut key is, the author has 
+   this script here opted to explicitly add the key combination to the
+   button's label:</p>
+
+   <pre>function addShortcutKeyLabel(button) {
+<strong>  if (button.accessKeyLabel != '')
+    button.value += ' (' + button.accessKeyLabel + ')';</strong>
+}
+addShortcutKeyLabel(document.getElementById('c'));</pre>
+
+   <p>Browsers on different platforms will show different labels, even
+   for the same key combination, based on the convention prevalent on
+   that platform. For example, if the key combination is the Control
+   key, the Shift key, and the letter C, a Windows browser might
+   display "<samp>Ctrl+Shift+C</samp>", whereas a Mac browser might
+   display "<samp>^⇧C</samp>", while an Emacs browser might
+   just display "<samp>C-C</samp>". Similarly, if the key combination
+   is the Alt key and the Escape key, Windows might use
+   "<samp>Alt+Esc</samp>", Mac might use
+   "<samp>⌥⎋</samp>", and an Emacs browser might use
+   "<samp>M-ESC</samp>" or "<samp>ESC ESC</samp>".</p>
+
+   <p>In general, therefore, it is unwise to attempt to parse the
+   value returned from the <code title=dom-accessKeyLabel><a href=#dom-accesskeylabel>accessKeyLabel</a></code> IDL attribute.</p>
+
+  </div>
+
+
   <h4 id=the-accesskey-attribute><span class=secno>8.4.2 </span>The <dfn title=attr-accesskey><code>accesskey</code></dfn> attribute</h4>
 
   <p>All <a href=#html-elements>HTML elements</a> may have the <code title=attr-accesskey><a href=#the-accesskey-attribute>accesskey</a></code> content attribute set. The

Modified: source
===================================================================
--- source	2011-10-27 20:27:22 UTC (rev 6772)
+++ source	2011-10-27 20:51:12 UTC (rev 6773)
@@ -82121,7 +82121,50 @@
   returns a string representing the actual key combination assigned by
   the user agent.</p>
 
+  <div class="example">
 
+   <p>In this example, an author has provided a button that can be
+   invoked using a shortcut key. To support full keyboards, the author
+   has provided "C" as a possible key. To support devices equipped
+   only with numeric keypads, the author has provided "1" as another
+   possibly key.</p>
+
+   <pre><input type=button value=Collect onclick="collect()"
+       <strong>accesskey="C 1"</strong> id=c></pre>
+
+  </div>
+
+  <div class="example">
+
+   <p>To tell the user what the shortcut key is, the author has 
+   this script here opted to explicitly add the key combination to the
+   button's label:</p>
+
+   <pre>function addShortcutKeyLabel(button) {
+<strong>  if (button.accessKeyLabel != '')
+    button.value += ' (' + button.accessKeyLabel + ')';</strong>
+}
+addShortcutKeyLabel(document.getElementById('c'));</pre>
+
+   <p>Browsers on different platforms will show different labels, even
+   for the same key combination, based on the convention prevalent on
+   that platform. For example, if the key combination is the Control
+   key, the Shift key, and the letter C, a Windows browser might
+   display "<samp>Ctrl+Shift+C</samp>", whereas a Mac browser might
+   display "<samp>^&#x21E7;C</samp>", while an Emacs browser might
+   just display "<samp>C-C</samp>". Similarly, if the key combination
+   is the Alt key and the Escape key, Windows might use
+   "<samp>Alt+Esc</samp>", Mac might use
+   "<samp>&#x2325;&#x238B;</samp>", and an Emacs browser might use
+   "<samp>M-ESC</samp>" or "<samp>ESC ESC</samp>".</p>
+
+   <p>In general, therefore, it is unwise to attempt to parse the
+   value returned from the <code
+   title="dom-accessKeyLabel">accessKeyLabel</code> IDL attribute.</p>
+
+  </div>
+
+
   <h4>The <dfn title="attr-accesskey"><code>accesskey</code></dfn> attribute</h4>
 
   <p>All <span>HTML elements</span> may have the <code




More information about the Commit-Watchers mailing list