Prevent the default action when the Apple keyboard handles a key

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 12:06:09 +02:00
parent 89cf6aa17b
commit d20db089e7
No known key found for this signature in database
GPG Key ID: 035F657DAE4AE7EC

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