Skip to content

Commit

Permalink
only preventDefault on keypress when appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
NoodleSushi committed Aug 27, 2023
1 parent 6e0d787 commit 13a8199
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -89,28 +89,30 @@
}
const keyDown = (e: KeyboardEvent) => {
e.preventDefault();
if (e.repeat)
return;
switch (e.key) {
case "z":
e.preventDefault();
bongoInteract(0, true);
break;
case "x":
e.preventDefault();
bongoInteract(1, true);
break;
}
};
const keyUp = (e: KeyboardEvent) => {
e.preventDefault();
if (e.repeat)
return;
switch (e.key) {
case "z":
e.preventDefault();
bongoInteract(0, false);
break;
case "x":
e.preventDefault();
bongoInteract(1, false);
break;
}
Expand Down

0 comments on commit 13a8199

Please sign in to comment.