Skip to content

Commit 196243e

Browse files
authored
Rollup merge of #74325 - GuillaumeGomez:focus-source-file-sidebar, r=kinnison
Focus on the current file in the source file sidebar Fixes #73360. r? @kinnison cc @rust-lang/rustdoc
2 parents a80559f + 52c65e0 commit 196243e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/librustdoc/html/static/source-script.js

+5
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,9 @@ function createSourceSidebar() {
140140
});
141141

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

0 commit comments

Comments
 (0)