drag_and_strum still preloads audio on every shifted keystroke while typing #3043
Unanswered
vitalibondar
asked this question in
Ideas and Issue Triage
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
#2978 fixed the listener leak in
drag_and_strum_controller(thank you — that was the bulk of the problem), and #2926 is closed. There's a second, smaller cause of the same symptom still present onmain, so I wanted to raise it here rather than reopen anything.What's left
handleKeyDownstill runs on every documentkeydown, including while typing in a comment box:Every shifted keystroke while composing a comment — capitals,
!,?,:— re-enters#preloadAudioFilesand constructs sixnew Audio()objects. With the leak fixed this now happens once per keystroke instead of once per leaked listener, so it is far less severe than before, but it is still real work on a hot path that has nothing to do with dragging.Suggested fix
The strum is only meaningful during an actual drag, so keydown originating from a text field can be ignored:
…checked at the top of
handleKeyDown. The easter egg during a real drag is unchanged.One caveat worth flagging: a naive version that treats every
<input>as text entry would also swallowbutton/submitinputs, so the guard should be written to skip those.Status
My original #2929 bundled this together with the same leak fix you shipped in #2978, so it's now half-redundant and conflicts with
main. I'm closing it and raising just the remaining half here, per CONTRIBUTING. If you'd like this change, I'm glad to open a fresh, minimal PR against currentmain— or to leave it alone if the cost is considered acceptable for an easter egg.All reactions