[webkit-dev] Syncing javascript keycode's across platforms

Darin Adler darin at apple.com
Wed Mar 28 16:06:08 PDT 2007

On Mar 28, 2007, at 3:43 PM, Adam Treat wrote:

> Currently the keycodes returned by the various platforms under  
> WebKit are nowhere near close to uniform.

Seems well worth fixing.

> This seems like something that should be standard across all  
> platforms that WebKit provides. It is unclear to me exactly how the  
> keycodes are generated by the different platforms.

It's easy to get confused because there are both key codes and  
character codes, and the keyCode and charCode functions behave  
differently for different event types.

Two functions to look at to understand the behavior are  
KeyboardEvent::keyCode and KeyboardEvent::charCode.

> The equivalent code for the mac would seem to be in platform/mac/ 
> KeyEventMac.mm:
>         // VK_UP (26) UP ARROW key
>         case NSUpArrowFunctionKey: return 0x26;
> The actual behavior under Safari seems to be to return '63232'

63232 is the value of NSUpArrowFunctionKey.

It would be good to survey behavior of other browsers, especially  
Internet Explorer, and change our behavior to match more closely.  
Please write a bug report once you have a clear idea what you think  
we should do.

     -- Darin

More information about the webkit-dev mailing list