Skip to content

Commit bbac29c

Browse files
committed
rustdoc: remove CSS @media (min-width: 701px)
The two rules within it can and should be done without the separate media query: * There ain't no rule saying a viewport can't be `700.5px` wide, since hardware pixels can be finer than CSS pixels. * The rule for the first example-wrap child should probably apply on mobile. * The rule for the source sidebar is overriden by the mobile rule setting `max-width: 100vw`, so it can be merged with the rest of the styles.
1 parent 194140b commit bbac29c

File tree

2 files changed

+11
-21
lines changed

2 files changed

+11
-21
lines changed

src/librustdoc/html/static/css/rustdoc.css

+10-20
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ img {
437437

438438
.source-sidebar-expanded .source .sidebar {
439439
overflow-y: auto;
440+
width: 300px;
440441
}
441442

442443
.source-sidebar-expanded .source .sidebar > *:not(#sidebar-toggle) {
@@ -1692,31 +1693,20 @@ details.rustdoc-toggle[open] > summary.hideme::after {
16921693
display: inline-block;
16931694
}
16941695

1695-
/* Media Queries */
1696-
1697-
/*
1698-
WARNING: RUSTDOC_MOBILE_BREAKPOINT MEDIA QUERY;
1699-
If you update this line, then you also need to update the line with the same warning
1700-
in storage.js plus the media query with (max-width: 700px)
1701-
*/
1702-
@media (min-width: 701px) {
1703-
/* In case there is no documentation before a code block, we need to add some margin at the top
1704-
to prevent an overlay between the "collapse toggle" and the information tooltip.
1705-
However, it's not needed with smaller screen width because the doc/code block is always put
1706-
"one line" below. */
1707-
.docblock > .example-wrap:first-child .tooltip {
1708-
margin-top: 16px;
1709-
}
1710-
1711-
.source-sidebar-expanded .source .sidebar {
1712-
width: 300px;
1713-
}
1696+
/* In case there is no documentation before a code block, we need to add some margin at the top
1697+
to prevent an overlay between the "collapse toggle" and the information tooltip.
1698+
However, it's not needed with smaller screen width because the doc/code block is always put
1699+
"one line" below. */
1700+
.docblock > .example-wrap:first-child .tooltip {
1701+
margin-top: 16px;
17141702
}
17151703

1704+
/* Media Queries */
1705+
17161706
/*
17171707
WARNING: RUSTDOC_MOBILE_BREAKPOINT MEDIA QUERY
17181708
If you update this line, then you also need to update the line with the same warning
1719-
in storage.js plus the media query with (min-width: 701px)
1709+
in storage.js
17201710
*/
17211711
@media (max-width: 700px) {
17221712
/* When linking to an item with an `id` (for instance, by clicking a link in the sidebar,

src/librustdoc/html/static/js/storage.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ window.currentTheme = document.getElementById("themeStyle");
1010
window.mainTheme = document.getElementById("mainThemeStyle");
1111

1212
// WARNING: RUSTDOC_MOBILE_BREAKPOINT MEDIA QUERY
13-
// If you update this line, then you also need to update the two media queries with the same
13+
// If you update this line, then you also need to update the media query with the same
1414
// warning in rustdoc.css
1515
window.RUSTDOC_MOBILE_BREAKPOINT = 701;
1616

0 commit comments

Comments
 (0)