Skip to content

Commit b8dd270

Browse files
authored
Rollup merge of rust-lang#97113 - GuillaumeGomez:search-ui-fixes, r=notriddle
Search GUI fixes The first fix is about the duplicated "in": ![Screenshot from 2022-05-17 13-25-53](https://user-images.githubusercontent.com/3050060/168814186-a4e9064f-4325-469c-8bf6-46ea2737a24f.png) The second fix is about the `<select>` broken style: ![Screenshot from 2022-05-17 13-37-03](https://user-images.githubusercontent.com/3050060/168814182-b1c5ae66-d8cf-4fd5-a227-5aa8cd8453ab.png) ![Screenshot from 2022-05-17 13-36-55](https://user-images.githubusercontent.com/3050060/168814184-be9e56f8-fad4-477c-899e-9abff4d4910c.png) You can test it [here](https://rustdoc.crud.net/imperio/search-ui-fixes/doc/foo/index.html?search=test). r? `@notriddle`
2 parents 7361b22 + 440bbce commit b8dd270

File tree

7 files changed

+43
-9
lines changed

7 files changed

+43
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.9.1
1+
0.9.2

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ table,
897897
margin-left: 0.25em;
898898
padding-left: 0.3125em;
899899
padding-right: 23px;
900-
border: 0;
900+
border: 1px solid;
901901
border-radius: 4px;
902902
outline: none;
903903
cursor: pointer;
@@ -2010,7 +2010,6 @@ details.rustdoc-toggle[open] > summary.hideme::after {
20102010

20112011
#crate-search {
20122012
border-radius: 4px;
2013-
border: 0;
20142013
}
20152014

20162015
.docblock {

src/librustdoc/html/static/css/themes/ayu.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ details.undocumented > summary::before {
236236

237237
#crate-search, .search-input {
238238
background-color: #141920;
239-
border-color: #424c57;
240-
color: #c5c5c5;
239+
/* Without the `!important`, the border-color is ignored for `<select>`... */
240+
border-color: #424c57 !important;
241241
}
242242

243243
.search-input {

src/librustdoc/html/static/css/themes/dark.css

+2-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ details.undocumented > summary::before {
217217
#crate-search, .search-input {
218218
color: #111;
219219
background-color: #f0f0f0;
220-
border-color: #000;
220+
/* Without the `!important`, the border-color is ignored for `<select>`... */
221+
border-color: #f0f0f0 !important;
221222
}
222223

223224
.search-input {

src/librustdoc/html/static/css/themes/light.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,9 @@ details.undocumented > summary::before {
209209
}
210210

211211
#crate-search, .search-input {
212-
color: #555;
213212
background-color: white;
214-
border-color: #e0e0e0;
213+
/* Without the `!important`, the border-color is ignored for `<select>`... */
214+
border-color: #e0e0e0 !important;
215215
}
216216

217217
.search-input:focus {

src/librustdoc/html/static/js/search.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1738,7 +1738,7 @@ function initSearch(rawSearchIndex) {
17381738

17391739
let output = "<div id=\"search-settings\">" +
17401740
`<h1 class="search-results-title">Results for ${escape(results.query.userQuery)}` +
1741-
`${typeFilter}</h1> in ${crates} </div>`;
1741+
`${typeFilter}</h1>${crates}</div>`;
17421742
if (results.query.error !== null) {
17431743
output += `<h3>Query parser error: "${results.query.error}".</h3>`;
17441744
output += "<div id=\"titles\">" +

src/test/rustdoc-gui/search-filter.goml

+34
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,37 @@ goto: file://|DOC_PATH|/test_docs/index.html?search=test&filter-crate=lib2
4545
wait-for: "#crate-search"
4646
assert-property: ("#crate-search", {"value": "lib2"})
4747
assert-false: "#results .externcrate"
48+
49+
// Checking that the text for the "title" is correct (the "All" comes from the "<select>").
50+
assert-text: ("#search-settings", "Results for test in All", STARTS_WITH)
51+
52+
// Checking the display of the crate filter.
53+
// We start with the light theme.
54+
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
55+
reload:
56+
57+
timeout: 2000
58+
wait-for: "#crate-search"
59+
assert-css: ("#crate-search", {
60+
"border": "1px solid rgb(224, 224, 224)",
61+
"color": "rgb(0, 0, 0)",
62+
"background-color": "rgb(255, 255, 255)",
63+
})
64+
65+
// We now check the dark theme.
66+
click: "#settings-menu"
67+
wait-for: "#settings"
68+
click: "#theme-dark"
69+
wait-for-css: ("#crate-search", {
70+
"border": "1px solid rgb(240, 240, 240)",
71+
"color": "rgb(17, 17, 17)",
72+
"background-color": "rgb(240, 240, 240)",
73+
})
74+
75+
// And finally we check the ayu theme.
76+
click: "#theme-ayu"
77+
wait-for-css: ("#crate-search", {
78+
"border": "1px solid rgb(66, 76, 87)",
79+
"color": "rgb(197, 197, 197)",
80+
"background-color": "rgb(20, 25, 32)",
81+
})

0 commit comments

Comments
 (0)