Skip to content

Commit 0772b6f

Browse files
committed
Defocus search bar in rustdoc pages
Escape now removes focus from the search bar
1 parent 687d3d1 commit 0772b6f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/librustdoc/html/static/main.js

+6
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@
258258
addClass(search, "hidden");
259259
removeClass(document.getElementById("main"), "hidden");
260260
}
261+
defocusSearchBar();
261262
break;
262263

263264
case "s":
@@ -1884,3 +1885,8 @@
18841885
function focusSearchBar() {
18851886
document.getElementsByClassName('search-input')[0].focus();
18861887
}
1888+
1889+
// Removes the focus from the search bar
1890+
function defocusSearchBar() {
1891+
document.getElementsByClassName('search-input')[0].blur();
1892+
}

0 commit comments

Comments
 (0)