Skip to content

Commit

Permalink
Automatically type untypeable characters
Browse files Browse the repository at this point in the history
  • Loading branch information
jessepav committed May 31, 2024
1 parent 38d4770 commit 7fae659
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion js/guided-typing.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,14 @@ function processTextInput(textarea, expandedText, successCheck, keyboard) {
textarea.style.removeProperty("color");
successCheck.style.removeProperty("display");
const nextChar = expandedText[t.length];
keyboard.highlightKeysForChar(nextChar);
const keys = keyboard.keysForChar(nextChar);
if (keys.length) // the keyboard can produce this character
keyboard.highlightKeys(keys);
else // type it for the user
setTimeout(() => {
textarea.value += nextChar;
processTextInput(textarea, expandedText, successCheck, keyboard);
}, 250);
}
}
}
Expand Down

0 comments on commit 7fae659

Please sign in to comment.