Could you add an eventlistener to disable your arrow keys and spacebar under normal circumstances? That will keep the page from scrolling up and down while playing the game (Same applies to the spacebar). This should not impact anyone adding comments since the game is embedded in an iframe (or some equivalent).
Within the keyup brackets ('ArrowUp', 'ArrowDown', 'Space), you can add e.preventDefault(); along with your variable updates
Example:
if(e.code == 'ArrowUp') {
e.preventDefault();
upPressed = true
}