From 0772b6faed23d736f5e63738dcd8839193cf0660 Mon Sep 17 00:00:00 2001 From: Johannes Boczek Date: Tue, 2 Jan 2018 19:47:44 +0100 Subject: [PATCH 1/2] Defocus search bar in rustdoc pages Escape now removes focus from the search bar --- src/librustdoc/html/static/main.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 559f8494fc3..5e4a02994b1 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -258,6 +258,7 @@ addClass(search, "hidden"); removeClass(document.getElementById("main"), "hidden"); } + defocusSearchBar(); break; case "s": @@ -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(); +} \ No newline at end of file From 3153d23bb79b2ce7a822acb4859823a713adbc35 Mon Sep 17 00:00:00 2001 From: Johannes Boczek Date: Tue, 2 Jan 2018 19:58:06 +0100 Subject: [PATCH 2/2] Indentation fix Fixed intentaion (tabs -> spaces) Added trailing newline --- src/librustdoc/html/static/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 5e4a02994b1..c128a812b93 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -258,7 +258,7 @@ addClass(search, "hidden"); removeClass(document.getElementById("main"), "hidden"); } - defocusSearchBar(); + defocusSearchBar(); break; case "s": @@ -1889,4 +1889,4 @@ function focusSearchBar() { // Removes the focus from the search bar function defocusSearchBar() { document.getElementsByClassName('search-input')[0].blur(); -} \ No newline at end of file +}