Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#3701 closed defect (wontfix)

keypress faux event

Reported by: guest Owned by: sjmiles
Priority: high Milestone:
Component: Events Version: 0.9
Keywords: Cc:
Blocked By: Blocking:

Description

on IE keypress faux event for [Delete] key vs. keypress for "."

both have evt.keyCode of 46 so special logic is needed for faux events vs regular events. Is there a better way to handle this...

Perhaps have dojo.keys store a faux keyCode as well and test for that in the keypress?

dojo.keys = {

... DELETE: 46, fauxDELETE: "DELETE", ...

};

Change History (4)

comment:1 Changed 12 years ago by sjmiles

Status: newassigned

For DELETE charCode is 0, for "." it's 46. On Mozilla, the keyCode for "." is 0, but won't let us set that value.

The 0 charCode identifies non-printable characters, and can be tested cross-browser. In other words:

works on all supported browsers if (!e.charCode && e.keyCode == dojo.keys.DELETE) ...

or

works on all supported browsers switch(!e.charCode && e.keyCode){ switch on non-printables

case dojo.keys.DELETE:

...

comment:2 Changed 12 years ago by sjmiles

Resolution: wontfix
Status: assignedclosed

comment:3 in reply to:  1 Changed 12 years ago by sjmiles

First sentence should read:

For DELETE charCode is 0, for "." it's 46. On Mozilla, the keyCode for "." is 0, but IE won't let us set that value.

comment:4 in reply to:  1 Changed 12 years ago by sjmiles

Sorry, code fragments got mangled. Wish I could edit trac entries. Anyway:

// works on all supported browsers 
if (!e.charCode && e.keyCode == dojo.keys.DELETE) ...

or

// works on all supported browsers 
switch(!e.charCode && e.keyCode){ // switch on non-printables
    case dojo.keys.DELETE: ...
Note: See TracTickets for help on using tickets.