From 80efb220e09e3dbaf8f69a5eee109dce40b1cd09 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 25 Jul 2014 08:54:38 -0700 Subject: [PATCH] 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 --- src/librustdoc/html/static/main.js | 4 ++-- 1 file 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 -- GitLab