Bug 226954 - Only processes single key event per frame
Summary: Only processes single key event per frame
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
: 236393 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-06-12 08:52 PDT by Michael Feldstein
Modified: 2022-02-10 10:27 PST (History)
6 users (show)

See Also:


Attachments
Example Video (262.35 KB, video/mp4)
2021-06-12 08:52 PDT, Michael Feldstein
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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. ***