<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>16972</bug_id>
          
          <creation_ts>2008-01-22 02:46:47 -0800</creation_ts>
          <short_desc>Wrong keyCode for Ctrl+Enter on Mac (should be 10 and not 13)</short_desc>
          <delta_ts>2025-09-08 18:25:09 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>CONFIGURATION CHANGED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=30397</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar, PlatformOnly</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Tom Adler">me</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>a_protyasha</cc>
    
    <cc>ap</cc>
    
    <cc>arv</cc>
    
    <cc>karlcow</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>67934</commentid>
    <comment_count>0</comment_count>
    <who name="Tom Adler">me</who>
    <bug_when>2008-01-22 02:46:47 -0800</bug_when>
    <thetext>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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67939</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-01-22 06:21:03 -0800</bug_when>
    <thetext>In my testing, Internet Explorer 7 behaves the same as Safari.

It&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67940</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-01-22 06:21:48 -0800</bug_when>
    <thetext>In other words, I think that key code should equal 10 for Ctrl+Enter, matching IE.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67941</commentid>
    <comment_count>3</comment_count>
    <who name="Tom Adler">me</who>
    <bug_when>2008-01-22 06:48:28 -0800</bug_when>
    <thetext>Sorry, I wan&apos;t attentive enough while testing IE7. I tested _keydown_ event in it, and it does produce 10 on ctrl+enter for _keypress_ event.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67943</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-01-22 07:13:59 -0800</bug_when>
    <thetext>I&apos;d like to keep this open to track a bug on the Mac side - we don&apos;t have this quirk there yet, but we should.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67944</commentid>
    <comment_count>5</comment_count>
    <who name="Tom Adler">me</who>
    <bug_when>2008-01-22 07:26:08 -0800</bug_when>
    <thetext>Then please document it! : )</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>75510</commentid>
    <comment_count>6</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-03-27 13:43:59 -0700</bug_when>
    <thetext>&lt;rdar://problem/5826166&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>158430</commentid>
    <comment_count>7</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2009-10-27 17:24:01 -0700</bug_when>
    <thetext>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?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>158441</commentid>
    <comment_count>8</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-10-27 18:02:18 -0700</bug_when>
    <thetext>(In reply to comment #7)
&gt; keypress should use the charCode (which is 13) .

You disagree with above comments - could you please explain why you find them wrong?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>158447</commentid>
    <comment_count>9</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2009-10-27 18:30:52 -0700</bug_when>
    <thetext>(In reply to comment #8)
&gt; (In reply to comment #7)
&gt; &gt; keypress should use the charCode (which is 13) .
&gt; 
&gt; You disagree with above comments - could you please explain why you find them
&gt; 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&apos;m starting to lean towards not touching keypress again and tell people to only use keydown, keyup and textInput.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>158449</commentid>
    <comment_count>10</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-10-27 18:59:50 -0700</bug_when>
    <thetext>&gt; 2. This is what Firefox does.

As a general rule, we do what IE does for key handling.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>158451</commentid>
    <comment_count>11</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2009-10-27 19:38:15 -0700</bug_when>
    <thetext>(In reply to comment #10)
&gt; &gt; 2. This is what Firefox does.
&gt; 
&gt; 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)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2133285</commentid>
    <comment_count>12</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2025-07-29 19:30:10 -0700</bug_when>
    <thetext>https://w3c.github.io/uievents/tools/key-event-viewer.html &lt;- Safari 18.6, Chrome Canary 140.0.7325.0 (Official Build) canary (arm64)  and Firefox Nightly 143 (20250729210451) - all show &apos;Ctrl + Enter&apos; with keyCode as 13 on macOS.

@Abrar - do we need to do anything here or if I am testing this wrong?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2141775</commentid>
    <comment_count>13</comment_count>
    <who name="Abrar Rahman Protyasha">a_protyasha</who>
    <bug_when>2025-09-08 18:24:42 -0700</bug_when>
    <thetext>(In reply to Ahmad Saleem from comment #12)
&gt; https://w3c.github.io/uievents/tools/key-event-viewer.html &lt;- Safari 18.6,
&gt; Chrome Canary 140.0.7325.0 (Official Build) canary (arm64)  and Firefox
&gt; Nightly 143 (20250729210451) - all show &apos;Ctrl + Enter&apos; with keyCode as 13 on
&gt; macOS.
&gt; 
&gt; @Abrar - do we need to do anything here or if I am testing this wrong?

This is no longer an issue. I just tested across Safari, Chrome, and Firefox too.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>