----- Original Message -----
From: "Křištof Želechovski" <[EMAIL PROTECTED]>
To: "'Andrew Fedoniouk'" <[EMAIL PROTECTED]>; "'Ian Hickson'"
<[EMAIL PROTECTED]>
Cc: "'WHAT WG List'" <[EMAIL PROTECTED]>
Sent: Thursday, August 09, 2007 11:15 AM
Subject: Re: [whatwg] Looking at menus in HTML5...
Please note that it indicates the text to entered and not the keys to
press.
Of course this is somewhat inconsistent with the tag name since the text
need not come from the keyboard at all, e.g. it can be pasted.
Your hint suggests that the user should enter text "Ctrl-C".
Happy coding,
Chris
Probably <kbd> does not mean key combinations exactly but this
is is closest what we can get.
Original meaning of <kbd> is so fuzzy so it was never used
for its purpose. At least I never seen <kbd> in the wild.
So it is probably safe to redefine it for keystrokes purpose.
I doubt that changing its role will break anything.
Speaking about shortcut resolution in general.
Here is one practical implementation that we have:
First of all we have extended format for @accesskey:
accesskey="A" - Alt-A (on Windows)
accesskey="!A" - just press on 'A' key - that is for mnemonics.
accesskey="^A" - Ctrl+A key.
Resolution of accesskey happens using following algorithm
(a bit simplified):
function checkForAccesskey(accesskey)
{
dom::element t = window.elementInFocus();
while ( t )
{
dom::element at = findAccessKeyInThisAndDescendants(t, accesskey) ;
if( at && at.activateElement() ) return true; // handled
t = t.parent(); // go to parent
}
return false;
}
function findAccessKeyInThisAndDescendants(element, accesskey)
{
return element.select( "[accesskey='%s']", accesskey); // a.k.a.
getElementBySelector()
}
As you may see such algorithm handles elements with duplicate
@accesskey attributes - it simply selects closest element to the
one that is in focus. checkForAccesskey is being called if
keyboard event was bubbled up unhandled.
This algorithm tested in real-life scenarios and applications.
I think this is best what we can get for HTML.
Andrew Fedoniouk.
http://terrainformatica.com
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Andrew Fedoniouk
Sent: Wednesday, August 08, 2007 9:46 PM
To: Křištof Želechovski; 'Ian Hickson'
Cc: 'WHAT WG List'
Subject: Re: [whatwg] Looking at menus in HTML5...
I would insist that following
<menu type="context-menu">
<li>Copy<kbd>Ctrl-C</kbd></li>
</menu>
1) is semantically correct construction as "KBD: Indicates text to be
entered by the user." [1]