title: Javascript: keydown event not firing
body: <p>I am writing a userscript with the following code:</p>
  
  <pre><code>(function() {
      'use strict';
      window.addEventListener("keydown", arrows, false);
      function arrows(e) {
          debugger;
          switch(e.keycode) {
               case 37: alert("Left"); break;
               case 39: alert("Right"); break;
          }
      }
  })();
  </code></pre>
  
  <p>Eventually the left and right cases will navigate to the previous and next articles in a series, respectively, with something like:</p>
  
  <pre><code>window.location = String(parseInt(window.location.href.match(/\d+$/))-1);
  </code></pre>
  
  <p>However, pressing the arrow keys does not cause an alert. The script is clearly loaded, the Chrome developer menu shows the <code>arrows()</code> function is registered as an event listener for <code>window.keydown</code>, and yet the function never fires. I added <code>debugger;</code> to the <code>arrows()</code> function, but the debugger does not show when I press the arrow keys.</p>