about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2021-05-31 12:11:05 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2021-05-31 15:20:45 +0200
commit9b637fa72e4d6a3aebcbf92cc4e18b94a7bf31b7 (patch)
treefa14777e94c92844e1aa72c15d4f325aff03be54 /src
parenta2ba9ef1ff363341bae9a9ced37f14fee68538ec (diff)
downloadrust-9b637fa72e4d6a3aebcbf92cc4e18b94a7bf31b7.tar.gz
rust-9b637fa72e4d6a3aebcbf92cc4e18b94a7bf31b7.zip
Improve display of the separation between page items and siblings in the sidebar
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/render/mod.rs2
-rw-r--r--src/librustdoc/html/static/rustdoc.css5
-rw-r--r--src/test/rustdoc-gui/sidebar.goml12
3 files changed, 16 insertions, 3 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index a7f3d70e462..19cb3950f47 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -1738,7 +1738,7 @@ fn print_sidebar(cx: &Context<'_>, it: &clean::Item, buffer: &mut Buffer) {
     // to navigate the documentation (though slightly inefficiently).
 
     if !it.is_mod() {
-        buffer.write_str("<p class=\"location\">");
+        buffer.write_str("<p class=\"location\">Other items in<br>");
         for (i, name) in cx.current.iter().take(parentlen).enumerate() {
             if i > 0 {
                 buffer.write_str("::<wbr>");
diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css
index f3866e211d9..da38052763d 100644
--- a/src/librustdoc/html/static/rustdoc.css
+++ b/src/librustdoc/html/static/rustdoc.css
@@ -304,9 +304,12 @@ nav.sub {
 	border: none;
 }
 
-.location a:first-child {
+.location a:first-of-type {
 	font-weight: 500;
 }
+.location a:hover {
+	text-decoration: underline;
+}
 
 .block {
 	padding: 0;
diff --git a/src/test/rustdoc-gui/sidebar.goml b/src/test/rustdoc-gui/sidebar.goml
index 5149b933162..388ca120d77 100644
--- a/src/test/rustdoc-gui/sidebar.goml
+++ b/src/test/rustdoc-gui/sidebar.goml
@@ -19,6 +19,9 @@ click: "#structs + table td > a"
 assert: (".sidebar .location", 2)
 // We check that there is no crate listed outside of the top level.
 assert-false: ".sidebar-elems > .crate"
+// We now go back to the crate page to click on the "lib2" crate link.
+goto: file://|DOC_PATH|/test_docs/index.html
+click: ".sidebar-elems > .crate > ul > li:first-child > a"
 
 // PAGE: lib2/index.html
 goto: file://|DOC_PATH|/lib2/index.html
@@ -35,10 +38,17 @@ click: "#functions + table td > a"
 // In items containing no items (like functions or constants) and in modules, we have one
 // "location" elements.
 assert: (".sidebar .location", 1)
+// There is a "<br>" tag between "in" and "lib2", but it doesn't count as a space.
+assert: (".sidebar .sidebar-elems .location", "Other items inlib2")
+// We check that we don't have the crate list.
+assert-false: ".sidebar-elems > .crate"
+
+goto: ./module/index.html
+assert: (".sidebar > .location", "Module module")
 // We check that we don't have the crate list.
 assert-false: ".sidebar-elems > .crate"
-goto: ./module/sub_module/sub_sub_module/index.html
 
+goto: ./sub_module/sub_sub_module/index.html
 assert: (".sidebar > .location", "Module sub_sub_module")
 // We check that we don't have the crate list.
 assert-false: ".sidebar-elems > .crate"