tour: fix pageup/pagedown navigation on non-chrome browsers
FF and IE fail to populate event.keyCode, but instead populate
event.which with the key code. event.key is a DOMString of "PageUp"
or "PageDown" in this case, so remove the invalid comparision to a
numeric key code and instead compare the keycode to event.which.
Fixes golang/go#8829
Change-Id: I7192d2e561e2be5472018d8a3b06a91ab9dab49b
Reviewed-on: https://go-review.googlesource.com/15001
Reviewed-by: Andrew Gerrand <adg@golang.org>
diff --git a/static/js/directives.js b/static/js/directives.js
index c4f287c..de2e12e 100755
--- a/static/js/directives.js
+++ b/static/js/directives.js
@@ -13,7 +13,7 @@
return function(scope, elm, attrs) {
elm.attr('tabindex', 0);
elm.keyup(function(evt) {
- var key = evt.key || evt.keyCode;
+ var key = evt.which || evt.keyCode;
if (key == 33 && !evt.ctrlKey) {
scope.$apply(attrs.onpageup);
evt.preventDefault();
@@ -27,7 +27,7 @@
return function(scope, elm, attrs) {
elm.attr('tabindex', 0);
elm.keyup(function(evt) {
- var key = evt.key || evt.keyCode;
+ var key = evt.which || evt.keyCode;
if (key == 34 && !evt.ctrlKey) {
scope.$apply(attrs.onpagedown);
evt.preventDefault();