Skip to content

Commit

Permalink
Rollup merge of rust-lang#74325 - GuillaumeGomez:focus-source-file-si…
Browse files Browse the repository at this point in the history
…debar, r=kinnison

Focus on the current file in the source file sidebar

Fixes rust-lang#73360.

r? @kinnison
cc @rust-lang/rustdoc
  • Loading branch information
Manishearth authored Jul 16, 2020
2 parents 0a4036c + 52c65e0 commit 0b6601d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/librustdoc/html/static/source-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,9 @@ function createSourceSidebar() {
});

main.insertBefore(sidebar, main.firstChild);
// Focus on the current file in the source files sidebar.
var selected_elem = sidebar.getElementsByClassName("selected")[0];
if (typeof selected_elem !== "undefined") {
selected_elem.focus();
}
}

0 comments on commit 0b6601d

Please sign in to comment.