Bug 226954

Summary: Only processes single key event per frame
Product: WebKit Reporter: Michael Feldstein <msfeldstein>
Component: UI EventsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: ap, cdumez, graouts, megan_gardner, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Example Video none

Description Michael Feldstein 2021-06-12 08:52:33 PDT
Created attachment 431260 [details]
Example Video

It appears WebKit only handles one input event, for example keypress, per animation frame.  This is ok if your app is super fast, or if you type slower than the fps, but if there's any performance issues it quickly causes multiple frame slowdowns.

Here is an example repro. It has a long-running animation frame to slow the fps down a bit. https://codepen.io/jlfwong/pen/GRWXzBM

If you type very quickly (just bash keys) in chrome it keeps up with your typing but if you do it in WebKit/Safari you'll quickly see the keys come in one at a time over many many frames.  This happens on Mac and iOS
Comment 1 Alexey Proskuryakov 2021-06-12 14:56:54 PDT
I verified that Chrome processes keypresses quickly even when there is an even handler attached, so it's not just a shortcut code path for a case when there isn't one.
Comment 2 Michael Feldstein 2021-06-14 08:04:30 PDT
Yes it happens with or without handlers attached, and i also confirmed Firefox does the fast multi-event handling behavior as well.
Comment 3 Radar WebKit Bug Importer 2021-06-19 08:53:16 PDT
<rdar://problem/79524727>
Comment 4 Alexey Proskuryakov 2022-02-10 10:27:30 PST
*** Bug 236393 has been marked as a duplicate of this bug. ***