Opened 11 years ago
Closed 11 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: |
Description
(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)
Change History (4)
Changed 11 years ago by
Attachment: | SpaceEventTest.html added |
---|
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
It's working for me to. I was trying to follow the rules given for "Keyboard Events" from the dojo campus events documentation:
http://docs.dojocampus.org/quickstart/events
It does not mention charCode at all.
Thanks,
- Ole
comment:3 Changed 11 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
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.
Looks like it's working for me. You want to be checking charCode - not keyCode.