Skip to content

Commit 382d5bb

Browse files
Focus on the current file in the source file sidebar
1 parent 4a689da commit 382d5bb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
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_elems = Array.prototype.slice.call(sidebar.getElementsByClassName("selected"));
145+
if (selected_elems.length > 0) {
146+
selected_elems[0].focus();
147+
}
143148
}

0 commit comments

Comments
 (0)