<?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>28409</bug_id>
          
          <creation_ts>2009-08-17 15:00:06 -0700</creation_ts>
          <short_desc>[Win] keypress should be dispatched for ctrl shortcuts</short_desc>
          <delta_ts>2024-01-18 02:55:39 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows XP</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=185971</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=30397</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>PlatformOnly</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Julie Parent">jparent</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>adele</cc>
    
    <cc>ap</cc>
    
    <cc>arv</cc>
    
    <cc>darin</cc>
    
    <cc>dbates</cc>
    
    <cc>jeffharris</cc>
    
    <cc>johndayrichter</cc>
    
    <cc>karlcow</cc>
    
    <cc>pvollan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>140841</commentid>
    <comment_count>0</comment_count>
      <attachid>34993</attachid>
    <who name="Julie Parent">jparent</who>
    <bug_when>2009-08-17 15:00:06 -0700</bug_when>
    <thetext>Created attachment 34993
Test case

Windows only - keypress is dispatched properly for Mac.  Reproduces in WebKit nightly, Safari 4.0.2, Chrome 3.*, Chrome 4.*.  Did not reproduce in Chrome 1.*

Repro steps:
1. Load the attached keypressexample.html.
2. Click into the window to make sure it has focus.
3. Type Ctrl+c, (or Ctrl+a or Ctrl+v)

Expected result:
WebKit should fire both a keydown and a keypress event. (These events will be logged to the screen by a script in the provided html page)

Result:
Only keydown is fired.

For more details, see original bug filed against Chrome: http://code.google.com/p/chromium/issues/detail?id=13891

Note: This seems to happen for a subset of Ctrl+* key combinations. I haven&apos;t
tried all of them, but it seems to happen only for ones where there is also
an existing browser editing keyboard shortcut like copy, paste, etc.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>140970</commentid>
    <comment_count>1</comment_count>
    <who name="Julie Parent">jparent</who>
    <bug_when>2009-08-17 18:53:07 -0700</bug_when>
    <thetext>+Adele, Darin, Alexey, who were all involved with similar issues on Mac (such as https://bugs.webkit.org/show_bug.cgi?id=25147).  Any ideas?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>140978</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-08-17 19:41:47 -0700</bug_when>
    <thetext>Why should WebKit dispatch keypress when no characters are tyoed? Per comments in Chromium bug, we match IE here. The bug is on Mac.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>151699</commentid>
    <comment_count>3</comment_count>
    <who name="John Day-Richter">johndayrichter</who>
    <bug_when>2009-10-01 14:29:14 -0700</bug_when>
    <thetext>(In reply to comment #2)

&gt; Why should WebKit dispatch keypress when no characters are tyoed? Per comments
&gt; in Chromium bug, we match IE here. The bug is on Mac.

The problem is not that keypress events are not dispatched. The problem is that webkit browsers seem to dispatch the events inconsistently. Here&apos;s a sample of behaviors:


Keystroke     Chrome (Windows) Events     Safari (Windows) Events
Ctrl+A        KEYDOWN, KEYUP              KEYDOWN, KEYUP
Ctrl+B        KEYDOWN, KEYPRESS, KEYUP    KEYDOWN, KEYPRESS, KEYUP
Ctrl+X        KEYDOWN, KEYUP              KEYDOWN, KEYUP
Ctrl+D        KEYDOWN, KEYPRESS           KEYDOWN

In both browsers all Ctrl+Shift+key combinations generate a keypress.

It doesn&apos;t much matter whether Webkit fires a keypress in these instances or not, but it would be very helpful if it had the same behavior for Ctrl+key combinations.

These tests were done using the tool at http://people.w3.org/rishida/utils/keyevents/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>151733</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-10-01 16:28:41 -0700</bug_when>
    <thetext>Comment 3 definitely describes a bug, but that&apos;s not what was reported here. If we fix the inconsistency by never dispatching keypress for these shortcuts, claiming that the original bug is resolved as fixed would be inappropriate.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>154937</commentid>
    <comment_count>5</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2009-10-15 16:18:20 -0700</bug_when>
    <thetext>Updating summary to reflect the desired behavior</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>156679</commentid>
    <comment_count>6</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2009-10-21 16:00:47 -0700</bug_when>
    <thetext>Sorry for the premature conclusions. I&apos;ve spent more time investigating this and we SHOULD fire keypress events when ctrl is pressed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>156693</commentid>
    <comment_count>7</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-10-21 16:16:21 -0700</bug_when>
    <thetext>Could you please post the investigation results here?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>156729</commentid>
    <comment_count>8</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2009-10-21 17:03:17 -0700</bug_when>
    <thetext>Internet Explorer does not fire keypress when ctrl is pressed with some exceptions. The following keys fire keypress. Some keys behave slightly different in editable elements. 

CTRL + | keyCode | contentEditable | textarea
-------+---------+-----------------+---------
 G     |  7      | Y               | Y
 M     | 13      | Y               | Y
 U     | 21      | N               | Y
 V     | 22      | N               | N
 X     | 24      | N               | N
 Y     | 25      | N               | N
 Z     | 26      | N               | N
 [     | 27      | Y               | Y
 \     | 28      | Y               | Y
 ]     | 29      | Y               | Y
 SPACE | 30      | Y               | Y
 ENTER | 10      | Y               | Y


Safari Mac

Always fires keypress when ctrl is pressed unless focus is in an editable element. The keyCode matches IE


Safari Windows

Never fires keypress when ctrl is pressed


Firefox Windows

Always fires keypress events. The main difference here is that Firefox returns the charCode of the key as if ctrl was not pressed. For example Ctrl+A returns

A:      {keyCode: 0, charCode: 97, ctrlKey: false}
Ctrl+A: {keyCode: 0, charCode: 97, ctrlKey: true}

For the keys on Safari Mac we get

A:      {keyCode: 97, charCode: 97, ctrlKey: false}
Ctrl+A: {keyCode: 1, charCode: 1, ctrlKey: true}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>189227</commentid>
    <comment_count>9</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2010-02-09 20:37:34 -0800</bug_when>
    <thetext>*** Bug 34767 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>34993</attachid>
            <date>2009-08-17 15:00:06 -0700</date>
            <delta_ts>2009-08-17 15:00:06 -0700</delta_ts>
            <desc>Test case</desc>
            <filename>keypressexample.html</filename>
            <type>text/html</type>
            <size>667</size>
            <attacher name="Julie Parent">jparent</attacher>
            
              <data encoding="base64">PGh0bWw+DQo8aGVhZD4NCjwvaGVhZD4NCjxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0Ij4N
CmZ1bmN0aW9uIGhhbmRsZUV2ZW50KGUpDQp7CiAgICB2YXIgZXZlbnRMb2cgPSBkb2N1bWVudC5n
ZXRFbGVtZW50QnlJZCgnZXZlbnRMb2cnKTsKICAgIHZhciBlbnRyeSA9IGRvY3VtZW50LmNyZWF0
ZUVsZW1lbnQoJ2RpdicpOwogICAgZW50cnkuaW5uZXJIVE1MID0gJ3R5cGU6ICcgKyBlLnR5cGUg
KyAnLCBrZXljb2RlOiAnICsgZS5rZXlDb2RlICsgJywgY2hhcmNvZGU6ICcgKyBlLmNoYXJDb2Rl
ICsgJywgY3RybEtleTogJyArIGUuY3RybEtleTsKICAgIGV2ZW50TG9nLmFwcGVuZENoaWxkKGVu
dHJ5KTsNCn0NCg0KZnVuY3Rpb24gaW5pdGV2ZW50KCkNCnsKICAgIGRvY3VtZW50LmFkZEV2ZW50
TGlzdGVuZXIoJ2tleWRvd24nLCBoYW5kbGVFdmVudCwgZmFsc2UpOw0KICAgIGRvY3VtZW50LmFk
ZEV2ZW50TGlzdGVuZXIoJ2tleXByZXNzJywgaGFuZGxlRXZlbnQsIGZhbHNlKTsNCn0NCjwvc2Ny
aXB0Pg0KDQo8Ym9keSBvbkxvYWQ9ImluaXRldmVudCgpOyI+DQo8ZGl2IGlkPSJldmVudExvZyI+
CjxkaXY+S2V5ZG93biBhbmQga2V5cHJlc3MgZXZlbnRzIHdpbGwgYmUgbG9nZ2VkIGJlbG93Ojxi
ci8+PGJyLz48L2Rpdj4KPC9kaXY+DQo8L2JvZHk+DQo8L2h0bWw+Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>