From d8eaf4fd3787963cfd1cf1df4fbe1446fda104a0 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 16:25:18 +0000 Subject: [PATCH] Fix pitch input being overwritten while user is typing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit edUpdateNotePanel() resets pitchInput.value on every call, but it runs on every edDraw() — including from requestAnimationFrame during preview, mouse events, and a 30ms setTimeout(edResize) loop. This caused any typed characters to be immediately overwritten. Now skip overwriting INPUT/SELECT values when that element has focus, so the user can freely type a new pitch like "A4" without it snapping back to the old value. https://claude.ai/code/session_01TLvDyKzUQekd9hzFuEJ5YX --- index.html | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 81b4656..45981d6 100644 --- a/index.html +++ b/index.html @@ -4998,14 +4998,21 @@ function edUpdateNotePanel(){ } panel.style.display="block"; var m=edMelody[edSelected]; - // Pitch input + // Pitch input — skip overwrite when user is actively typing in it var pitchInput=document.getElementById("ed-note-pitch"); - pitchInput.value=m.f?edFreqToNote(m.f):""; - // Duration dropdown + if(document.activeElement!==pitchInput){ + pitchInput.value=m.f?edFreqToNote(m.f):""; + } + // Duration dropdown — skip if focused var durSel=document.getElementById("ed-note-dur"); - durSel.value=edDurSecToName(m.d||0); - // Lane dropdown - document.getElementById("ed-note-lane").value=m.l; + if(document.activeElement!==durSel){ + durSel.value=edDurSecToName(m.d||0); + } + // Lane dropdown — skip if focused + var laneEl=document.getElementById("ed-note-lane"); + if(document.activeElement!==laneEl){ + laneEl.value=m.l; + } // Info line var info="t="+m.t.toFixed(3)+"s"; if(m.f)info+=" | freq="+m.f.toFixed(1)+"Hz";