Opened 13 years ago

Closed 13 years ago

#10309 closed defect (worksforme)

event.charOrCode == dojo.keys.SPACE is false when triggered by space bar

Reported by: ole Owned by: sjmiles
Priority: high Milestone: tbd
Component: Events Version: 1.4.0b
Keywords: Cc: [email protected]
Blocked By: Blocking:


(event.charOrCode == dojo.keys.SPACE) is false for me when using the space bar to trigger the event.

(event.charOrCode == " ") is true and so is:

event.keyChar == " "

alert(dojo.keys.SPACE); >>> 32

When triggered by space bar:

alert(event.keyCode) >>> 0

Is the dojo.keys.SPACE value correct?

I'm using Firefox 3.5 / Linux / KDE 4.3

Attachments (1)

SpaceEventTest.html (1.1 KB) - added by ole 13 years ago.

Download all attachments as: .zip

Change History (4)

Changed 13 years ago by ole

Attachment: SpaceEventTest.html added

comment:1 Changed 13 years ago by Nathan Toone

Looks like it's working for me. You want to be checking charCode - not keyCode.

comment:2 Changed 13 years ago by ole

It's working for me to. I was trying to follow the rules given for "Keyboard Events" from the dojo campus events documentation:

It does not mention charCode at all.


  • Ole

comment:3 Changed 13 years ago by Douglas Hays

Resolution: worksforme
Status: newclosed

use event.charOrCode == " ". dojo.keys.SPACE is used for keyCode checking. Since a space character can be represented by a single character, then that takes precedence to the keyCode representation.

Note: See TracTickets for help on using tickets.