<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - WebKit provides a keypress event with wrong which/keyCode/charCode directly after a composition started with ^,´,` completes"
   href="https://bugs.webkit.org/show_bug.cgi?id=167880">167880</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>WebKit provides a keypress event with wrong which/keyCode/charCode directly after a composition started with ^,´,` completes
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>WebKit Nightly Build
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>macOS 10.12
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Event Handling
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>Carsten.driesner&#64;open-xchange.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Entering text into a contenteditable=true HTML element by pressing one of the keys ^, ´, ` on the Mac (German keyboard) starts a composition session. If one presses a second key which won't create a single character with the first one (e.g. â), the following keypress event contains the data of the key that started the composition (not the data of the pressed key).

Example:
Use the web page www.danilatos.com/event-test/ExperimentTest.html which records the events that the browser provides if one enter text into a div with contenteditable=true.

1. Set the cursor into the &quot;Editing&quot; field
2. Press ´ which starts the composition
3. Press v which ends the composition
4. Look at the event recorded

You can see the following events (part of the whole event list):
...
keyup 86 (V)
input
DOMSubtreeModified
DOMCharacterDataModified
dom axctually changed
textInput
keypress 180 (´)
keydown 86 (V)
input
DOMSubtreeModified
DOMCharacterDataModified
dom actually changed
DOMSubtreeModified
DOMCharacterDataModified
dom actually changed
textInput
compositionend
...

The issue is related to the keypress event which reports that ´ was entered although V (correctly reported by keydown/keyup) would be correct. The properties which, keyCode, charCode contain the value of the compositionend data property. If one would use ^ to start the composition the following keypress event would contain 94 (^).</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>