Friday, September 15, 2006

Macs Cursor Keys

One thing that can cause some issues when using Safari is that the Mac keyboard (OS) generates different key values for the cursor keys. Most applications that monitor key strokes will tend to discard any key value that is above 128, so for the Mac, the cursor related keys get ignored or worse yet, generates error messages indicating an invalid key was entered.

The following are Mac Key Codes values for Cursor related keys:

Key Code
Up Arrow 63232
Down Arrow 63233
Left Arrow 63234
Right Arrow 63235
DEL (fn-delete) 63272
Home (fn-LeftArrow) 63273
End of Line (fn-RightArrow) 63275
Page Up (fn-UpArrow) 63276
Page Down (fn-DownArrow) 63277


Please note that when these same keys are tested on IE v6.0.2900 for XP Pro, they did not generate any events within the JavaScript's window.event! They must be treated like silent modifiers. I would have thought that at least the DEL key or the BACKSPACE key would have a key code value being trapped.


One odd key is the ESC on the PC. It produces a code value of 27 and clears the text area. I don't know if that is expected or always a desired behavior.

No comments: