Skip to content

Commit c790128

Browse files
committed
Improve wrapping on settings page
Previously, the radio button choices for themes would wrap awkwardly on narrow screens. With this change, the group of choices will prefer bumping down to the next line together, leaving the setting name on its own line. Also fix some minor spacing issues: - Align the setting name vertically with the radio button choices. - Use margin instead of padding for most spacing choices. - Use no margin/padding on the right-hand side.
1 parent e0e70c0 commit c790128

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

src/librustdoc/html/render/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ impl Setting {
376376
description,
377377
),
378378
Setting::Select { js_data_name, description, default_value, ref options } => format!(
379-
"<div class=\"setting-line\"><div class=\"radio-line\" id=\"{}\"><span class=\"setting-name\">{}</span>{}</div></div>",
379+
"<div class=\"setting-line\"><div class=\"radio-line\" id=\"{}\"><span class=\"setting-name\">{}</span><div class=\"choices\">{}</div></div></div>",
380380
js_data_name,
381381
description,
382382
options

src/librustdoc/html/static/css/settings.css

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.setting-line {
2-
padding: 5px;
2+
margin: 0.6em 0 0.6em 0.3em;
33
position: relative;
44
}
55

@@ -17,17 +17,16 @@
1717
border-bottom: 1px solid;
1818
}
1919

20-
.setting-line .radio-line {
20+
.setting-line .radio-line,
21+
.setting-line .choices {
2122
display: flex;
2223
flex-wrap: wrap;
2324
}
2425

25-
.setting-line .radio-line > * {
26-
padding: 0.3em;
27-
}
28-
2926
.setting-line .radio-line .setting-name {
3027
flex-grow: 1;
28+
margin-top: auto;
29+
margin-bottom: auto;
3130
}
3231

3332
.setting-line .radio-line input {
@@ -38,7 +37,10 @@
3837
border-radius: 0.1em;
3938
border: 1px solid;
4039
margin-left: 0.5em;
41-
min-width: 3.5em;
40+
margin-top: 0.1em;
41+
margin-bottom: 0.1em;
42+
min-width: 3.8em;
43+
padding: 0.3em;
4244
}
4345

4446
.toggle {

src/test/rustdoc-gui/mobile.goml

+6
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,9 @@ assert-css: (".content .out-of-band .since::before", { "content": "\"Since \"" }
1515

1616
size: (1000, 1000)
1717
assert-css-false: (".content .out-of-band .since::before", { "content": "\"Since \"" })
18+
19+
// On the settings page, the theme buttons should not line-wrap. Instead, they should
20+
// all be placed as a group on a line below the setting name "Theme."
21+
goto: file://|DOC_PATH|/settings.html
22+
size: (400, 600)
23+
compare-elements-position-near-false: ("#preferred-light-theme .setting-name", "#preferred-light-theme .choice", {"y": 16})

0 commit comments

Comments
 (0)