Skip to content

Commit

Permalink
fix unknown keys bug
Browse files Browse the repository at this point in the history
  • Loading branch information
gdsc0301 committed Sep 13, 2023
1 parent 1caab0c commit 4840db1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ function App() {
return prev.slice(0, -1);
}

// if any key that is not a letter or number or space or backspace is pressed
if (!e.key.match(/^[a-zA-Z0-9?!'.+\- ]*$/) || e.key.length > 1) {
return prev;
}

if(prev.length >= displays.length) {
enoughRef.current.classList.add('high');

Expand Down Expand Up @@ -62,7 +67,7 @@ function App() {
));
}, [mainText]);

const openKeyboard = (e) => {
const openKeyboard = () => {
if ("virtualKeyboard" in navigator) {
navigator.virtualKeyboard.show();
}
Expand Down

0 comments on commit 4840db1

Please sign in to comment.