Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e496f50

Browse files
committedSep 8, 2023
rustdoc: make the hide setting apply in mobile
This makes the setting meaningful in all contexts: it hides the sidebar on desktop, and hides the topbar on mobile.
1 parent 4627474 commit e496f50

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed
 

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

+4
Original file line numberDiff line numberDiff line change
@@ -1734,6 +1734,10 @@ in src-script.js
17341734
top: 0;
17351735
}
17361736

1737+
.hide-sidebar .mobile-topbar {
1738+
display: none;
1739+
}
1740+
17371741
.sidebar-menu-toggle {
17381742
width: 45px;
17391743
/* Rare exception to specifying font sizes in rem. Since this is acting

‎src/librustdoc/html/static/js/settings.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@
194194
"default": false,
195195
},
196196
{
197-
"name": "Hide navigation sidebar",
197+
"name": "Hide persistent navigation bar",
198198
"js_name": "hide-sidebar",
199199
"default": false,
200200
},
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Checks sidebar resizing stays synced with the setting
2+
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
3+
set-window-size: (400, 600)
4+
5+
// Verify that the "hide" option is unchecked
6+
click: "#settings-menu"
7+
wait-for: "#settings"
8+
assert-css: ("#settings", {"display": "block"})
9+
assert-property: ("#hide-sidebar", {"checked": "false"})
10+
assert-css: (".mobile-topbar", {"display": "flex"})
11+
12+
// Toggle it
13+
click: "#hide-sidebar"
14+
assert-property: ("#hide-sidebar", {"checked": "true"})
15+
assert-css: (".mobile-topbar", {"display": "none"})
16+
17+
// Toggle it again
18+
click: "#hide-sidebar"
19+
assert-property: ("#hide-sidebar", {"checked": "false"})
20+
assert-css: (".mobile-topbar", {"display": "flex"})

0 commit comments

Comments
 (0)
Please sign in to comment.