Advice needed for scopes in JavaScript
How can I not mess up the global scope?


You can use an IIFE ( Immediately Invoked Function Expression ) to surround your code and then assign all your variables with var &lt;- Very important.

(function(){

  var quicksearch = document.getElementById('quicksearch_top');
  var comment = document.getElementById('comment');

  var severity = document.getElementById('bug_severity');
  var priority = document.getElementById('priority');

  var commit_top = document.getElementById('commit_top');
  var commit = document.getElementById('commit'); 

  //the rest of your code here

}()); 



  How should I use functions (in var or not)?


It really is up to you, at this point I prefer function.

Other than that:

You should use lowerCamelCasing, so


commit_top -> commitTop
quicksearch -> quickSearch
selectelement -> selectElement


etc.etc

Your keycode map is very nice, keep it that way!

One last comment is that you should not use document.onkeydown = navigation;, there is a good chance that you will break something this way.

Try document.addEventListener("keydown", navigation, true); instead.