about summary refs log tree commit diff
path: root/src/librustdoc/html/static/css/rustdoc.css
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2022-07-03 16:41:56 -0400
committerGitHub <noreply@github.com>2022-07-03 16:41:56 -0400
commit87df0f1fbecb7454db6ff35f97e724b7bf919848 (patch)
tree4a11518ad7998dc583bef528f6b2c3c6c6ea754d /src/librustdoc/html/static/css/rustdoc.css
parentb0d831a48675d54ae7ab9dea2a603c356b79d54b (diff)
parente710ac12fac9d650fb53b27259332cabdc9416f5 (diff)
downloadrust-87df0f1fbecb7454db6ff35f97e724b7bf919848.tar.gz
rust-87df0f1fbecb7454db6ff35f97e724b7bf919848.zip
Rollup merge of #98773 - notriddle:notriddle/source-sidebar-details, r=GuillaumeGomez
rustdoc: use <details> tag for the source code sidebar

This fixes the extremely poor accessibility of the old system, making it possible to navigate the sidebar by keyboard, and also implicitly gives the sidebar items the correct ARIA roles.

Split out separately from #98772
Diffstat (limited to 'src/librustdoc/html/static/css/rustdoc.css')
-rw-r--r--src/librustdoc/html/static/css/rustdoc.css37
1 files changed, 11 insertions, 26 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index f7b4fdb736c..ebff1dc92ea 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -1578,38 +1578,23 @@ kbd {
 	margin-bottom: 1em;
 }
 
-div.children {
-	padding-left: 27px;
-	display: none;
+details.dir-entry {
+	padding-left: 4px;
 }
-div.name {
+
+details.dir-entry > summary {
+	margin: 0 0 0 13px;
+	list-style-position: outside;
 	cursor: pointer;
-	position: relative;
-	margin-left: 16px;
 }
-div.files > a {
-	display: block;
-	padding: 0 3px;
-}
-div.files > a:hover, div.name:hover {
-	background-color: #a14b4b;
+
+details.dir-entry div.folders, details.dir-entry div.files {
+	padding-left: 23px;
 }
-div.name.expand + .children {
+
+details.dir-entry a {
 	display: block;
 }
-div.name::before {
-	content: "\25B6";
-	padding-left: 4px;
-	font-size: 0.625rem;
-	position: absolute;
-	left: -16px;
-	top: 4px;
-}
-div.name.expand::before {
-	transform: rotate(90deg);
-	left: -15px;
-	top: 2px;
-}
 
 /* The hideme class is used on summary tags that contain a span with
 	placeholder text shown only when the toggle is closed. For instance,