WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
REOPENED
16972
Wrong keyCode for Ctrl+Enter on Mac (should be 10 and not 13)
https://bugs.webkit.org/show_bug.cgi?id=16972
Summary
Wrong keyCode for Ctrl+Enter on Mac (should be 10 and not 13)
Tom Adler
Reported
2008-01-22 02:46:47 PST
I assign keypress listener to textarea. When I press Ctrl+Enter, this listener receives event parameter with keyCode value equal to 10. But when I press just Enter, keyCode is equal to 13. It is also 13 for Ctrl+Enter in other major browsers. This is true for Safari 3.0.4 and WebKit
r29711
Attachments
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2008-01-22 06:21:03 PST
In my testing, Internet Explorer 7 behaves the same as Safari. It's a bug that we produce different codes for Ctrl+Enter on Windows and on Mac, but I would qualify it as a Mac-side bug.
Alexey Proskuryakov
Comment 2
2008-01-22 06:21:48 PST
In other words, I think that key code should equal 10 for Ctrl+Enter, matching IE.
Tom Adler
Comment 3
2008-01-22 06:48:28 PST
Sorry, I wan't attentive enough while testing IE7. I tested _keydown_ event in it, and it does produce 10 on ctrl+enter for _keypress_ event.
Alexey Proskuryakov
Comment 4
2008-01-22 07:13:59 PST
I'd like to keep this open to track a bug on the Mac side - we don't have this quirk there yet, but we should.
Tom Adler
Comment 5
2008-01-22 07:26:08 PST
Then please document it! : )
Alexey Proskuryakov
Comment 6
2008-03-27 13:43:59 PDT
<
rdar://problem/5826166
>
Erik Arvidsson
Comment 7
2009-10-27 17:24:01 PDT
keypress should use the charCode (which is 13) . This seems correct on Safari Mac but wrong on Safari Windows which returns keyCode 10. What does the rdar bug say we want to do here?
Alexey Proskuryakov
Comment 8
2009-10-27 18:02:18 PDT
(In reply to
comment #7
)
> keypress should use the charCode (which is 13) .
You disagree with above comments - could you please explain why you find them wrong?
Erik Arvidsson
Comment 9
2009-10-27 18:30:52 PDT
(In reply to
comment #8
)
> (In reply to
comment #7
) > > keypress should use the charCode (which is 13) . > > You disagree with above comments - could you please explain why you find them > wrong?
I think the whole keypress issue is giving me too many sleepless nights. The reason why I found it wrong was two reasons. 1. It is valuable to be able to do String.fromCharCode(event.keyCode) in a keypress handler. 2. This is what Firefox does. I think I'm starting to lean towards not touching keypress again and tell people to only use keydown, keyup and textInput.
Alexey Proskuryakov
Comment 10
2009-10-27 18:59:50 PDT
> 2. This is what Firefox does.
As a general rule, we do what IE does for key handling.
Erik Arvidsson
Comment 11
2009-10-27 19:38:15 PDT
(In reply to
comment #10
)
> > 2. This is what Firefox does. > > As a general rule, we do what IE does for key handling.
We should update the title to say: Wrong keyCode for Ctrl+Enter on Mac (should be 10 and not 13)
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug