Skip to content

Commit

Permalink
[e] (0) Add examples for accessKeyLabel
Browse files Browse the repository at this point in the history
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=13902

git-svn-id: http://svn.whatwg.org/webapps@6773 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Oct 27, 2011
1 parent f4ec649 commit dab594b
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 0 deletions.
42 changes: 42 additions & 0 deletions complete.html
Expand Up @@ -72156,6 +72156,48 @@ <h4 id=introduction-8><span class=secno>8.4.1 </span>Introduction</h4>
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>&lt;input type=button value=Collect onclick="collect()"
<strong>accesskey="C 1"</strong> id=c&gt;</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>^&#8679;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>&#8997;&#9099;</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>

Expand Down
42 changes: 42 additions & 0 deletions index
Expand Up @@ -72156,6 +72156,48 @@ interface <dfn id=navigatorstorageutils>NavigatorStorageUtils</dfn> {
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>&lt;input type=button value=Collect onclick="collect()"
<strong>accesskey="C 1"</strong> id=c&gt;</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>^&#8679;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>&#8997;&#9099;</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>

Expand Down
43 changes: 43 additions & 0 deletions source
Expand Up @@ -82121,6 +82121,49 @@ interface <dfn>NavigatorStorageUtils</dfn> {
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>&lt;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>

Expand Down

0 comments on commit dab594b

Please sign in to comment.