1
Fork 0

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
This commit is contained in:
Alex Crichton 2014-07-25 08:54:38 -07:00
parent 724bcec089
commit 80efb220e0

View file

@ -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