Bug 278652

Summary: [GTK] keydown/up gives outdated modifier state
Product: WebKit Reporter: Roope Salmi <rpsalmi>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: bugs-noreply
Priority: P2    
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Example HTML demonstrating the issue none

Roope Salmi
Reported 2024-08-26 08:17:11 PDT
Created attachment 472297 [details] Example HTML demonstrating the issue Ubuntu 22.04.4 WebKitGTK 2.44.2-0ubuntu0.22.04.1 or local build @ https://commits.webkit.org/281240@main Example HTML (attached): <script> window.addEventListener("keydown", (e) => { document.body.innerHTML = `keydown ${e.ctrlKey} ${e.altKey} ${e.shiftKey}`; }); window.addEventListener("keyup", (e) => { document.body.innerHTML = `keyup ${e.ctrlKey} ${e.altKey} ${e.shiftKey}`; }); </script> Press one of the modifier keys down and up, and observe the text. Actual behavior on GTK4: 1. Press Ctrl down 2. Text is "keydown false false false" 3. Release Ctrl 4. Text is "keyup true false false" Actual behavior on GTK3: 1. Press Ctrl down 2. Text is "keydown true false false" 3. Release Ctrl 4. Text is "keyup true false false" Expected behavior: 1. Press Ctrl down 2. Text is "keydown true false false" 3. Release Ctrl 4. Text is "keyup false false false"
Attachments
Example HTML demonstrating the issue (289 bytes, text/html)
2024-08-26 08:17 PDT, Roope Salmi
no flags
Roope Salmi
Comment 1 2024-08-26 08:53:51 PDT
Also applies to event.getModifierState()
Roope Salmi
Comment 2 2024-08-27 04:56:00 PDT
Another tangentially related issue is that the modifiers are not updated in PointerEvents when a pointer lock is active.
Note You need to log in before you can comment on or make changes to this bug.