Skip to content

Commit e85df08

Browse files
committed
Don't move cursor in search box when using arrows to navigate search results
1 parent f3fadf6 commit e85df08

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/librustdoc/html/static/main.js

+2
Original file line numberDiff line numberDiff line change
@@ -1396,6 +1396,7 @@ function defocusSearchBar() {
13961396

13971397
addClass(actives[currentTab][0].previousElementSibling, "highlighted");
13981398
removeClass(actives[currentTab][0], "highlighted");
1399+
e.preventDefault();
13991400
} else if (e.which === 40) { // down
14001401
if (!actives[currentTab].length) {
14011402
var results = document.getElementById("results").childNodes;
@@ -1409,6 +1410,7 @@ function defocusSearchBar() {
14091410
addClass(actives[currentTab][0].nextElementSibling, "highlighted");
14101411
removeClass(actives[currentTab][0], "highlighted");
14111412
}
1413+
e.preventDefault();
14121414
} else if (e.which === 13) { // return
14131415
if (actives[currentTab].length) {
14141416
document.location.href =

0 commit comments

Comments
 (0)