Skip to content

Commit

Permalink
Defocus search bar in rustdoc pages
Browse files Browse the repository at this point in the history
Escape now removes focus from the search bar
  • Loading branch information
Sogomn committed Jan 2, 2018
1 parent 687d3d1 commit 0772b6f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/librustdoc/html/static/main.js
Expand Up @@ -258,6 +258,7 @@
addClass(search, "hidden");
removeClass(document.getElementById("main"), "hidden");
}
defocusSearchBar();
break;

case "s":
Expand Down Expand Up @@ -1884,3 +1885,8 @@
function focusSearchBar() {
document.getElementsByClassName('search-input')[0].focus();
}

// Removes the focus from the search bar
function defocusSearchBar() {
document.getElementsByClassName('search-input')[0].blur();
}

0 comments on commit 0772b6f

Please sign in to comment.