Re: Proposal to add USB keycodes to the current DOM3 key events

On Fri, Sep 7, 2012 at 11:44 AM, Travis Leithead
<travis.leithead@microsoft.com> wrote:
>> From: garykac@google.com [mailto:garykac@google.com] On Behalf Of Gary
>>
>> I've written up a brief proposal to enhance the current DOM Level 3
>> key events by adding USB keycodes.
>
> Nice. Yes, getting the keyboard layout-independent position of a key was specifically out-of-scope for DOM Level 3 Events. I don't know much about the USB key codes, but it looks promising as a standard way of getting key location interop across OS/languages.
>
> I did want to call out a sentence from you problem statement:
>
> "Games and other applications which treat the keyboard as a large collection of buttons need to be able to keep track of which keys are currently being held down. ***Since there is no API to query the current keyboard state***, it is crucial that apps be able to match every keyup event with the originating keydown event."
>
> An old strawman was proposed in 2009 for this: http://www.w3.org/2008/webapps/wiki/Query_Key_Status, but is still worth pursuing/revising.

Thanks for the comments!

I agree that an API to query the keyboard state is definitely
worthwhile, but I feel this proposal is independent from whatever
decision we eventually make with regard to a QueryKeyStatus API.

The most serious problem with the current key event spec is that there
is no reliable way to link keyup events with the corresponding keydown
event. Even if we added a QueryKeyStatus API, this would still be
broken.

-Gary

Received on Friday, 7 September 2012 20:25:00 UTC