Prevent the default action when the Apple keyboard handles a key (#151)

Before, if the browser window wasn't tall enough to show the whole
keyboard, using the arrow keys in the window would cause the page
to move as well.  Now all key events that are sent to the keyboard
have `preventDefault()` called on them.
This commit is contained in:
Ian Flanigan 2022-08-21 21:37:03 +02:00 committed by GitHub
parent 89cf6aa17b
commit 62568d19f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -118,9 +118,7 @@ export const Keyboard = ({ apple2, e }: KeyboardProps) => {
if (document.activeElement && document.activeElement !== document.body) {
return;
}
if (event.key === ' ') {
event.preventDefault();
}
event.preventDefault();
const key = mapKeyEvent(event, active.includes('LOCK'));
if (key !== 0xff) {
// CTRL-SHIFT-DELETE for reset