about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-07-25 08:54:38 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-07-25 08:56:00 -0700
commit80efb220e09e3dbaf8f69a5eee109dce40b1cd09 (patch)
treeae5759f1d6307cea6c958d19b33a15cea8ed82dd /src
parent724bcec089b34ede9b09aa72dac78ab554516603 (diff)
downloadrust-80efb220e09e3dbaf8f69a5eee109dce40b1cd09.tar.gz
rust-80efb220e09e3dbaf8f69a5eee109dce40b1cd09.zip
rustdoc: Bind keydown instead of keypress for nav
Apparently keypress doesn't quite work in all browsers due to some not invoking
the handler and jquery not setting the right `which` field in all circumstances.
According to http://stackoverflow.com/questions/2166771 switching over to
`keydown` works and it appears to do the trick. Tested in Safari, Firefox, and
Chrome.

Closes #15011
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/static/main.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index fc1e480f6af..1869031dab3 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -357,8 +357,8 @@
                 }, 20);
             });
 
-            $(document).off('keypress.searchnav');
-            $(document).on('keypress.searchnav', function(e) {
+            $(document).off('keydown.searchnav');
+            $(document).on('keydown.searchnav', function(e) {
                 var $active = $results.filter('.highlighted');
 
                 if (e.which === 38) { // up