Skip to content

Commit 0591703

Browse files
Improve display of sidebar button to prevent it being underneath sticky section headings
1 parent 0a18a7e commit 0591703

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

Diff for: src/librustdoc/html/static/css/rustdoc.css

+17-5
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ xmlns="http://www.w3.org/2000/svg" fill="black" height="18px">\
4040
--docblock-indent: 24px;
4141
--mobile-top-navbar-height: 45px;
4242
--collapse-toggle-left: -24px;
43+
--main-top-padding: 10px;
44+
--search-top-margin: 4px;
45+
--sidebar-button-size: 34px;
4346
}
4447

4548
/* See FiraSans-LICENSE.txt for the Fira Sans license. */
@@ -367,7 +370,7 @@ button#toggle-all-docs {
367370
main {
368371
position: relative;
369372
flex-grow: 1;
370-
padding: 10px 15px 40px 45px;
373+
padding: var(--main-top-padding) 15px 40px 45px;
371374
min-width: 0; /* avoid growing beyond the size limit */
372375
}
373376

@@ -1005,7 +1008,7 @@ div.where {
10051008
nav.sub {
10061009
flex-grow: 1;
10071010
flex-flow: row nowrap;
1008-
margin: 4px 0 0 0;
1011+
margin: var(--search-top-margin) 0 0 0;
10091012
display: flex;
10101013
align-items: center;
10111014
}
@@ -1872,13 +1875,22 @@ a.tooltip:hover::after {
18721875
display: flex;
18731876
margin-right: 4px;
18741877
position: fixed;
1875-
left: 6px;
1876-
height: 34px;
1877-
width: 34px;
18781878
background-color: var(--main-background-color);
18791879
z-index: 1;
18801880
}
1881+
.hide-sidebar #sidebar-button {
1882+
left: 0;
1883+
/* We need to do all this so this button is positioned correctly but also to hide everything
1884+
going under beneath it. */
1885+
height: calc(var(--sidebar-button-size) + var(--main-top-padding) + var(--search-top-margin));
1886+
/* 6px is the left padding */
1887+
width: calc(var(--sidebar-button-size) + 6px);
1888+
padding-left: 6px;
1889+
padding-top: calc(var(--main-top-padding) + var(--search-top-margin));
1890+
}
18811891
.src #sidebar-button {
1892+
height: var(--sidebar-button-size);
1893+
width: var(--sidebar-button-size);
18821894
left: 8px;
18831895
z-index: calc(var(--desktop-sidebar-z-index) + 1);
18841896
}

0 commit comments

Comments
 (0)