Closed axelkern closed 3 months ago
Searched a bit on this topic. Potentially adding the following to the event handling routines in keyboard.tsx could resolve the issue (only if a valid Hack key was recognized in the mapping):
event.preventDefault();
event.stopPropagation();
Tool
CPU Emulator
Interface
Website (https://nand2tetris.github.io/web-ide)
Contact Details
No response
What happened?
It seems that Keyboard events of are not consumed by the emulator.
If navigation keys like the cursor keys, PgUp/PgDn,, etc. are pressed with enabled keyboard, the key strokes are not only consumed by the emulator, but passed on to the browser as well. The effect becomes obvious when there is not enough space in the browser window to display the output screen and the registers completely. The browser will then scroll the screen panel depending on the keystrokes - regardless if the keyboard is enabled or disabled. The effect is the same in the VM emulator, though less obvious since the browser window needs to be quite small to enforce scroll panels in the screen output.
The correct behavior should be that the emulators consumes all Hack-relevant keystrokes exclusively.
Additional Comments
No response
Do you want to try to fix this bug?
Code of Conduct