Quanyu001 commited on
Commit
5321c2f
·
verified ·
1 Parent(s): b7689fb

Playground: refocusing the command box after a step no longer scrolls the page to the top

Browse files
Files changed (1) hide show
  1. playground/app.js +1 -1
playground/app.js CHANGED
@@ -260,7 +260,7 @@
260
  await loadState(result.state_diff || []);
261
  renderBudget(result.budget);
262
  } catch (exc) { showError(exc.message); if (/BudgetExhausted/.test(exc.message)) { state.exhausted = true; $("send-button").disabled = true; } }
263
- finally { setBusy(false); if (!state.exhausted) $("send-button").disabled = false; $("command-input").focus(); }
264
  }
265
  const send = () => send_(state.play && $("command-input").value === state.play.steps[state.nextStep]?.text ? state.nextStep : undefined);
266
  function badge(text, cls) { return el("span", `badge ${cls || ""}`, text); }
 
260
  await loadState(result.state_diff || []);
261
  renderBudget(result.budget);
262
  } catch (exc) { showError(exc.message); if (/BudgetExhausted/.test(exc.message)) { state.exhausted = true; $("send-button").disabled = true; } }
263
+ finally { setBusy(false); if (!state.exhausted) $("send-button").disabled = false; $("command-input").focus({ preventScroll: true }); }
264
  }
265
  const send = () => send_(state.play && $("command-input").value === state.play.steps[state.nextStep]?.text ? state.nextStep : undefined);
266
  function badge(text, cls) { return el("span", `badge ${cls || ""}`, text); }