Open Bug 48951 Opened 24 years ago Updated 2 years ago

Need to use VK_ keyCode constants in .js files


(Core :: DOM: UI Events & Focus Handling, defect, P3)

Windows 98





(Reporter: aaronlev, Unassigned)


(Keywords: helpwanted, Whiteboard: [keybnd][wgate])

From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
BuildID:    200073008

Right now, people are using hard coded constants for keyCode.
For example, if (keyCode==13) {dosomething();}
That's not good! Should be able to say if (keyCode==VK_ENTER) ...

Reproducible: Always
Steps to Reproduce:
1. Try to use any VK_ or DOM_VK constant, it doesn't work.

Actual Results:  		-					

Expected Results:  							-

I'll take this one -- it's related to some other work I'm doing.
Ever confirmed: true
Target Milestone: --- → M19
Reassigning to akkana.
Assignee: joki → akkana
It turns out that most of these are already available, in MouseKeyEvent.idl.  I
have a fix in my tree (awaiting review and XP testing of a bunch of other
associated changes) which makes the NS_VK_* symbols in nsGUIEvent.h dependant on
the dom versions of the same symbols (which in turn are generated from
MouseKeyEvent.idl), so we'll only have one master copy of the keycode list.
The symbols come from MouseKeyEvent.idl.  The fix I mentioned to reconcile the
symbols in widget has been checked in.  In theory, you should be able to use the
VK_ symbols from JS.  In practice, I haven't had a chance to test this.  Someone
please try it and see if it works!
Akkana, I've just tested this with a cvs build from after your last report. I 
see that DOM_VK_blah are all defined in MouseKeyEvent.idl, but I get a 
Javascript 'symbol undefined' error when I try to use one of them. Is there 
some statement I need in the javascript to make those .idl definitions 
The fix to dom/public/idl/events/MouseKeyEvent.idl won't go into the tree,
as the rest of dom/public/idl.
The results of idlc need to be generated and checked in, to get this into the
Are those names defined in DOM3? I just saw links to the first public
working draft on, but those aren't public yet. (access denied).
Adding jst and vidur for insight in dom standards and building wisdom

moving to future
Keywords: helpwanted
Target Milestone: M19 → Future
Updating QA Contact.
QA Contact: janc → lorca
Reassigning QA Contact for all open and unverified bugs previously under Lorca's
care to Gerardo as per phone conversation this morning.
QA Contact: lorca → gerardok
Whiteboard: [keybnd]
QA contact updated
QA Contact: gerardok → madhur
URL: -
Whiteboard: [keybnd] → [keybnd][wgate]
QA Contact: madhur → rakeshmishra
QA Contact: rakeshmishra → trix
QA Contact: trix → events
Akkana, are you still working on this?
Also, it seems .keyCode is deprecated.
Flags: needinfo?(akkzilla)
No, sorry, I don't even have a copy of the codebase any more.
Assignee: akkzilla → nobody
Flags: needinfo?(akkzilla)
Component: Event Handling → User events and focus handling
Severity: minor → S4
You need to log in before you can comment on or make changes to this bug.