Disable arrow key scrolling in users browser
Summary Simply prevent the default browser action: window.addEventListener(“keydown”, function(e) { if([“Space”,”ArrowUp”,”ArrowDown”,”ArrowLeft”,”ArrowRight”].indexOf(e.code) > -1) { e.preventDefault(); } }, false); If you need to support Internet Explorer or other older browsers, use e.keyCode instead of e.code, but keep in mind that keyCode is deprecated and you need to use actual codes instead of strings: // Deprecated code! … Read more