Skip to content

Commit

Permalink
insert letter on keydown instead
Browse files Browse the repository at this point in the history
  • Loading branch information
wmpedersen committed Feb 4, 2024
1 parent 413accd commit 8f38805
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions assets/scripts/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var submissionLst = [];
KEYBOARD_EL.innerHTML = `<div id="keyboard-cont">
<div class="first-row">
<button class="keyboard-button boxed" id="q">Q</button>
<button class="keyboard-button boxed" id="q">W</button>
<button class="keyboard-button boxed" id="w">W</button>
<button class="keyboard-button boxed" id="e">E</button>
<button class="keyboard-button boxed" id="r">R</button>
<button class="keyboard-button boxed" id="t">T</button>
Expand Down Expand Up @@ -413,6 +413,7 @@ document.addEventListener("keydown", (e) => {
if (!found || found.length > 1) {
return
} else if (document.querySelector(`#${pressedKey.toLowerCase()}`) && !document.querySelector(`#${pressedKey.toLowerCase()}`).classList.contains("clicked")) {
insertLetter(pressedKey)
document.querySelector(`#${pressedKey.toLowerCase()}`).classList.add("clicked")
return;
} else {
Expand Down Expand Up @@ -440,7 +441,6 @@ document.addEventListener("keyup", (e) => {
if (!found || found.length > 1) {
return
} else {
insertLetter(pressedKey)
document.querySelector(`#${pressedKey.toLowerCase()}`).classList.remove("clicked");
return;
}
Expand Down

0 comments on commit 8f38805

Please sign in to comment.