From 6aa33133512e0af3de4429eb6d7ab335e1751f5d Mon Sep 17 00:00:00 2001
From: Paul Kaplan <pkaplan@media.mit.edu>
Date: Tue, 27 Nov 2018 10:17:51 -0500
Subject: [PATCH] Prevent arrow/space from scrolling the page

This is needed to make the project page work as expected. In the future, investing in ways of making those accessility features work would be good. But for now, it is broken for everyone because it both sends events to the VM _and_ scrolls the page.
---
 src/lib/vm-listener-hoc.jsx | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/lib/vm-listener-hoc.jsx b/src/lib/vm-listener-hoc.jsx
index 9dee35d75..908aef1b5 100644
--- a/src/lib/vm-listener-hoc.jsx
+++ b/src/lib/vm-listener-hoc.jsx
@@ -82,6 +82,12 @@ const vmListenerHOC = function (WrappedComponent) {
                 key: e.key,
                 isDown: true
             });
+
+            // Prevent space/arrow key from scrolling the page.
+            if (e.keyCode === 32 || // 32=space
+                (e.keyCode >= 37 && e.keyCode <= 40)) { // 37, 38, 39, 40 are arrows
+                e.preventDefault();
+            }
         }
         handleKeyUp (e) {
             // Always capture up events,
-- 
GitLab