Opera KeyCodes - Bug #162259

Certain keydown/keyup events return invalid keyboard code

Fixed in Opera 9.0 Beta 1

This page is set up to capture the keydown event and return the associated keyboard code. Every key on any keyboard is assigned a code number which the browser receives and handles. For instance, if you press the A key, the number 65 will appear. Likewise, if you press the Up-Arrow key, you'll see the number 38.

However, there are certain keys which Opera doesn't seem to understand. Pressing the Insert, Delete, Home or End keys all return a keyboard code of 0. This same error occurs on keyup events as well, even though only keydown events are captured by this page. Opening this document in Firefox/Mozilla will show the correct codes returned for these keydowns: 45, 46, 36 and 35 respectively.

Even though keyboard events aren't in the current DOM2 specification, by pressing other keys it is apparent that Opera supports many keyboard codes to the same degree as Mozilla. However, for a select number of keys, the codes returned are erronious for no specific reason. Put simply: Opera should not return 0 (zero) as a valid keyCode for a keyup/keydown event.

Opera returns 0 for the following keys on keydown/keyup (actual keyboard code):


Main Bug List