Based on Rods' example (see url above), I can see that the Mac isn't always
sending a keycode for some keys for keydown/keyup events.
Here are a few of the keys which don't work:
shift-1 thru shift-0
any key with the option modifier
setting to m18
this is related to the other key event issues, providing the correct key event
functions for users is critical
setting to nsbeta3+
adding priority to status whiteboard, not *that* complicated but it'll take time
to get it right
reassign to akkana; akkana--we probably need to do something hacky like create a
table similar to how gtk works. I don't have any other ideas. :-/
Actually, joki recently gave me the go-ahead to put those missing symbols into
nsGUIEvent/nsIDOMKeyEvent. I'm hoping to overhaul those files soon (so we only
have the list of keycodes in one place!), and if I have time, I'll also change
the linux key event code, and, if I can figure out how :-), I'll also do the mac
event code, which would be the best fix to this bug.
Per beppe: setting this to nsbeta3- and reassigning back to brade.
this is correctness of events, low risk fix
reviewed by Bijal and beppe, setting to nsbeta3+, p2
pdtp4. It's not clear there is any user visible impact for this bug. If it
exists and is merely obscure, please clarify and bring it back to the pdt.
on the mac many key events do not work, if it is acceptable for key events to
not work on the mac -- see the first entry in this bug -- then please remark as
pdt priority of your choice and future it. Personally, my opinion is that is a
Incidentally, we're expecting char codes for these characters, not key codes,
right? All the examples given are printable characters.
setting to nsbeta3- and setting to future, there are menu items that can be
used, which is a viable workaround
To paraphrase someone, the future is now. Can we revisit this bug and figure out
if it's going to make the next train?
okay, clearing the milestone so that we reconsider this.
probably won't make this train unless someone else picks it up; milestone-->
removing myself from the cc list
Any relation to bug 111335, bug 148130? Does this block bug 122479?
This bug is about the keydown and keyup events on Mac sending a 0 keycode
instead of the proper value. The event is still being sent (not that I've
Bug 111335 is about the events not being received at all. If that is true, it
will block verification of this bug since you need to see the event before you
can look at the keycode for it.
This particular bug is unrelated to bug 122479 (accesskey usage on Mac).
Accesskey modifier is "Control" and this bug is about shifted key events.
(Possibly both are blocked by 111335?)
This bug is effecting all peoplesoft customers on mac os. Since many of our
users jobs require data entry, having hot keys is a major plus for them. Since
we cannot get the keycode with the alt key now means that none of out hot keys
will work on NS 7 on mac. Do we know when this is planned to be fixed. Is there
a workaround we could use.
Eamon_Gaffney@peoplesoft.com (comment 19):
By "hot keys" do you mean accesskeys like for forms? On the Mac, those are
accessed with Control key not the alt key. If you have a
case where the accesskeys don't work on Macintosh, please file a new mozilla bug
with the url or a sample html file and cc me (firstname.lastname@example.org).
your question was "what do I mean by access keys"
I mean that our system has a number of hot keys to allow users to, say, add a
new row with the Alt+7 button. However no matter what combination I tried the
evt.keycode always returns 0 and as a result this makes it difficult to resolve
what key the user pressed.
Eamon_Gaffney@peoplesoft.com (comment 21): you could try looking at the keyevent
on keypress instead of keydown (looking at event.charCode). Perhaps paste in a
snippet of your html/js?
Created attachment 116231 [details]
Here is the test page. You will see if you are on mac and press Alt+7 it says 0 instead of 55
save this file as a html and view in NS 7 on mac. You will see that when you
press alt+7 the alert message says the keycode is 0 it should be 55 if you try
in windows env.
This bug is targeted at a Mac classic platform/OS, which is no longer supported
by mozilla.org. Please re-target it to another platform/OS if this bug applies
there as well or resolve this bug.
I will resolve this bug as WONTFIX in four weeks if no action has been taken.
To filter this and similar messages out, please filter for "mac_cla_reorg".
This is still an issue on Mac OS X 10 [Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.9a1) Gecko/20060304 SeaMonkey/1.5a].
*** Bug 300678 has been marked as a duplicate of this bug. ***
Created attachment 246186 [details]
KeyEvent viewer w/ modifiers
I've been using this doc to see KeyEvent values. As it stands, just using 'Shift' w/ a key does not work. This page works reasonably well w/ Safari/Firefox.
Still happening in Mac 10.4/Intel Gecko 20070309 Firefox 220.127.116.11. Any modifier key combined with number keys row
reports keycode 0 on a keydown event. Was attempting to use for accessibility shortcuts via a generalized keystroke to function/method mapping system.
-> Default Asignee
This has sat for long enough. Josh, is this going to be an issue with the new Cocoa key handling?
This still happens under Cocoa.
Changing component, then, and requesting blocking1.9. I know this affects the TIBCO General Interface toolkit, possibly others.
Jesse, can you comment on the difficulties this bug causes so that drivers can triage properly?
See also bug 308565 and bug 192935.
The mission of TIBCO General Interface is to web applications with the look and feel of desktop graphical user interface application. To that end, we implement many features typically found in Windows and Mac OS X, such as key accelerators. For example, when you type Ctrl+S in the GI IDE, the component you are working on is saved. We have been able to implement key accelerators on Internet Explorer and Firefox for Windows without a problem. We capture the keydown event and look at the keyCode field of the event object. We use code that I'll add as an attachment (keyCodeToString.js). The problem is that on Firefox on Mac OS X, some keys are reported incorrectly. For example ctrl+. is reported as ctrl+n. (See https://bugzilla.mozilla.org/show_bug.cgi?id=44259). Moreover, the mapper error from key to keyCode is not recoverable because ctrl+. and ctrl+n report the same keyCode value.
Created attachment 265057 [details]
Created attachment 268446 [details] [diff] [review]
This fixes a whole bunch of key codes, almost everything in this bug plus a bunch more. I didn't fix the ones that don't have a clear definition according to DOM specs.
Created attachment 268451 [details] [diff] [review]
oops, I forgot to diff part of the patch
Comment on attachment 268451 [details] [diff] [review]
> if (aKeyEvent->isControl)
> charCode += 64;
Is this still necessary now that you use charactersIgnoringModifiers? Did that break Control-key handling?
>+ if (charCode >= 'a' && charCode <= 'z') // lowercase
> geckoKeyCode = toupper(charCode);
> else if (charCode >= 'A' && charCode <= 'Z') // uppercase
> geckoKeyCode = charCode;
I know you didn't write this, but couldn't you optimize this function by moving the common ASCII char cases to the top of the function?
Created attachment 268569 [details] [diff] [review]
This removes the nasty control key logic ben mentioned because that causes some bugs and looks like a mistake made back in the original event branch back in 1999.
This also adds support for colon.
Comment on attachment 268569 [details] [diff] [review]
Looks good to me. Josh and I couldn't think of a reason the +64 call was there. When we looked up the blamelog, that code landed in 1999.
Not code I'm familiar with (I don't know cocoa key events) but the +64 is presumably because ctrl + A (ascii 65) is ascii 1, and so on.
Presumably this is no longer needed for the current code, if it's already getting a char code of A rather than 1 from the native key event.
I'm not an appropriate reviewer for this -- you should probably ask jst or smaug.
I put the URL for the spec I was basing my key event values on in the URL field of this bug.
Another note on my choice of DOM key code values - I checked with IE, WebKit and Opera and Opera seems to be the only browser that doesn't just assign seemingly random numbers to anything beyond alphanumeric keys. Thus, I made sure my work matched up as closely as possible with Opera's implementation, and their implementation matches the WD DOM 2 spec pretty closely.
IE and WebKit don't match up with each other or Opera or the WD spec, as far as I can tell they just made up their own key codes.
Comment on attachment 268569 [details] [diff] [review]
Opera gives the same 0x2d for INSERT as we do currently, so I wouldn't change it.
(Tested on Linux/trunk and Opera 9.2)
(And as far as I see, Opera doesn't follow the old DOM 2 WD elsewhere either. For example pressing '+' in the keypad gives 0x2b, not 0x6B nor 0x0209)
And if you add support for new VK_s, those should be, IMO, supported in all major platforms, if possible.
And http://lxr.mozilla.org/seamonkey/source/content/xbl/src/nsXBLPrototypeHandler.cpp#606 should be updated too.
Slightly modified test http://mozilla.pettay.fi/moztests/showkeys.html
Created attachment 270134 [details] [diff] [review]
This is very similar to the patch from before, but I am not trying to support key codes that aren't already supported in gecko. I think we should file separate bugs for any particular key codes not fixed by this patch.
Comment on attachment 270134 [details] [diff] [review]
Looks good to me.
Comment on attachment 270134 [details] [diff] [review]
did you test the charactersIgnoringModifiers change on non-roman languages and languages with accents (french, spanish, etc)?
Hi, the following key codes work on Internet Explorer and Fx for Windows and Fx for Mac when no modifier keys are held down:
Event.KEY_ALT = 18;
Event.KEY_ARROW_DOWN = 40;
Event.KEY_ARROW_LEFT = 37;
Event.KEY_ARROW_RIGHT = 39;
Event.KEY_ARROW_UP = 38;
Event.KEY_BACKSPACE = 8;
Event.KEY_CONTROL = 17;
Event.KEY_DELETE = 46;
Event.KEY_END = 35;
Event.KEY_ENTER = 13;
Event.KEY_ESCAPE = 27;
Event.KEY_HOME = 36;
Event.KEY_INSERT = 45;
Event.KEY_PAGE_DOWN = 34;
Event.KEY_PAGE_UP = 33;
Event.KEY_SHIFT = 16;
Event.KEY_SPACE = 32;
Event.KEY_TAB = 9;
Event.KEY_0 = 48;
Event.KEY_9 = 57;
Event.KEY_A = 65;
Event.KEY_Z = 90;
Event.KEY_F1 = 112;
Event.KEY_F15 = 126;
Event.KEY_NP0 = 96; // number pad key variants
Event.KEY_NP9 = 105;
Event.KEY_NPDIV = 111;
Event.KEY_NPMUL = 106;
Event.KEY_NPSUB = 109;
Event.KEY_NPADD = 107;
Event.KEY_NPDEC = 110;
landed on trunk
I did some testing on Japanese and accented characters and it worked fine.
I've been watching this bug on and off for eight years now and just tested it in the recently released Macintosh version of Firefox 3.0. Sorry guys, it is only partially fixed.
Zero keycodes are still returned for
In addition, though shift-= (+) no longer returns a zero keycode, it now returns an incorrect keycode, 107 instead of 61. From the response above, I guess this is the keycode for the number pad plus key, not the keyboard plus key.
Keys typed with ALT do work now, as do all the shifted number keys and the unshifted - key.
Reopening per comment 50. The testcase attachment 246186 [details] continues to demonstrate the problems Jan describes.
Greg, Jan: I think you should open a new bug for that. It sounds like a regression since this apparently was working a year ago.
(In reply to comment #52)
> Greg, Jan: I think you should open a new bug for that. It sounds like a
> regression since this apparently was working a year ago.
I don’t think it’s a regression. Josh landed the fix on trunk on 2007-06-29. The earliest Mac GranParadiso build that contains the fix (2007080209/3.0a7) still fails the cases in comment 50.
Anyway, if you still think it should be filed as a new bug let me know and I’ll file it.
Since the bulk of the keycodes were fixed, it's easier to track (and fix) the overlooked cases in a focused, separate bug.
(In reply to comment #54)
> Since the bulk of the keycodes were fixed, it's easier to track (and fix) the
> overlooked cases in a focused, separate bug.
Filed as bug 448434.