Skip to content

Commit

Permalink
Fixed keyboard handeling
Browse files Browse the repository at this point in the history
  • Loading branch information
jLynx committed Jan 8, 2024
1 parent 55b7e80 commit d6f8d19
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/app/components/Controller/Controller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ const Controller = () => {
};

const handleKeyDown = (e: React.KeyboardEvent) => {
if (/[a-zA-Z0-9]/.test(e.key) || e.key === "Backspace" || e.key === " ") {
if (
(e.key.length === 1 && /[a-zA-Z0-9 ]/.test(e.key)) ||
e.key === "Backspace"
) {
e.preventDefault();
let key_code = e.key.length === 1 ? e.key.charCodeAt(0) : e.keyCode;
const keyHex = key_code.toString(16).padStart(2, "0").toUpperCase();
Expand Down

0 comments on commit d6f8d19

Please sign in to comment.