Skip to content

Commit

Permalink
rustdoc: add margin between scrollbar/resizer and links
Browse files Browse the repository at this point in the history
This makes it easier to interact with these things without accidentally
dragging a link around.
  • Loading branch information
notriddle committed Sep 11, 2023
1 parent 96afcaa commit 8714dd1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ ul.block, .block li {
display: block;
padding: 0.25rem; /* 4px */
margin-left: -0.25rem;
margin-right: 0.25rem;
}

.sidebar h2 {
Expand All @@ -593,6 +594,7 @@ ul.block, .block li {
color: var(--sidebar-link-color);
}
.sidebar .current,
.sidebar .current a,
.sidebar a:hover:not(.logo-container) {
background-color: var(--sidebar-current-link-background-color);
}
Expand Down
12 changes: 6 additions & 6 deletions src/librustdoc/html/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,11 +476,11 @@ function preLoadCss(cssUrl) {
const current_page = document.location.href.split("/").pop();
const link = document.createElement("a");
link.href = path;
if (path === current_page) {
link.className = "current";
}
link.textContent = name;
const li = document.createElement("li");
if (path === current_page) {
li.className = "current";
}
li.appendChild(link);
ul.appendChild(li);
}
Expand Down Expand Up @@ -613,12 +613,12 @@ function preLoadCss(cssUrl) {
for (const crate of window.ALL_CRATES) {
const link = document.createElement("a");
link.href = window.rootPath + crate + "/index.html";
if (window.rootPath !== "./" && crate === window.currentCrate) {
link.className = "current";
}
link.textContent = crate;

const li = document.createElement("li");
if (window.rootPath !== "./" && crate === window.currentCrate) {
li.className = "current";
}
li.appendChild(link);
ul.appendChild(li);
}
Expand Down

0 comments on commit 8714dd1

Please sign in to comment.