keep focus on currentInput

This commit is contained in:
filifa 2025-12-11 23:49:34 -05:00
parent 7fb2cbf7d9
commit 0bd3b5682d
1 changed files with 5 additions and 2 deletions

View File

@ -160,12 +160,12 @@ function setCurrentInput() {
function clear() {
currentInput.value = "";
// TODO: set current input as focused
currentInput.focus();
}
function keyPress(c) {
currentInput.value += c;
// TODO: set current input as focused
currentInput.focus();
}
document.querySelector("#expr").addEventListener("focus", setCurrentInput);
@ -194,3 +194,6 @@ document.querySelector("#pow").addEventListener("click", () => keyPress("^"));
document.querySelector("#clear").addEventListener("click", clear);
document.querySelector("#enter").addEventListener("click", calculate);
// FIXME buttons don't work if you try to insert in the middle of the text
// TODO backspace is probably going to be tricky