Skip to content

Commit 262c548

Browse files
committed
Fix workout editor keyboard closing when typing speed #4224
Avoid calling renderIntervals() when speed/pace fields change. Instead, directly update the synced field's DOM value to keep focus and keyboard open during input. https://claude.ai/code/session_01PX2BfeXuZgwAnfHckfS3Gw
1 parent 4dea13d commit 262c548

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

src/inner_templates/workouteditor/workout-editor-app.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -919,19 +919,26 @@
919919
const field = FIELD_DEFS.find(f => f.key === key);
920920
if (field && field.syncWith) {
921921
state.intervals[index][field.syncWith] = speed;
922+
// Update speed field directly without re-render to keep focus
923+
const speedInput = document.querySelector(`input[data-index="${index}"][data-key="${field.syncWith}"]`);
924+
if (speedInput) {
925+
speedInput.value = speed;
926+
}
922927
}
923928
}
924-
// Re-render to update both fields
925-
renderIntervals();
926929
updateChart();
927930
updateStatus();
928931
return;
929932
} else if (type === 'number') {
930933
const raw = target.value;
931934
state.intervals[index][key] = raw === '' ? undefined : Number(raw);
932-
// If this is a speed field, re-render to update pace
935+
// If this is a speed field, update pace field directly without re-render to keep focus/keyboard open
933936
if (key === 'speed') {
934-
renderIntervals();
937+
const paceInput = document.querySelector(`input[data-index="${index}"][data-key="pace"]`);
938+
if (paceInput) {
939+
const speedValue = state.intervals[index][key];
940+
paceInput.value = speedValue ? speedToPace(speedValue) : '';
941+
}
935942
}
936943
} else {
937944
const raw = target.value;

0 commit comments

Comments
 (0)