about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/static/source-script.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/librustdoc/html/static/source-script.js b/src/librustdoc/html/static/source-script.js
index cfbfe6675f5..5c39e760f44 100644
--- a/src/librustdoc/html/static/source-script.js
+++ b/src/librustdoc/html/static/source-script.js
@@ -140,4 +140,9 @@ function createSourceSidebar() {
     });
 
     main.insertBefore(sidebar, main.firstChild);
+    // Focus on the current file in the source files sidebar.
+    var selected_elems = Array.prototype.slice.call(sidebar.getElementsByClassName("selected"));
+    if (selected_elems.length > 0) {
+        selected_elems[0].focus();
+    }
 }