Skip to content

Commit 80efb22

Browse files
committed
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
1 parent 724bcec commit 80efb22

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/librustdoc/html/static/main.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,8 @@
357357
}, 20);
358358
});
359359

360-
$(document).off('keypress.searchnav');
361-
$(document).on('keypress.searchnav', function(e) {
360+
$(document).off('keydown.searchnav');
361+
$(document).on('keydown.searchnav', function(e) {
362362
var $active = $results.filter('.highlighted');
363363

364364
if (e.which === 38) { // up

0 commit comments

Comments
 (0)