Skip to content

Add UI to help with advanced search requests #99469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/librustdoc/html/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1446,6 +1446,7 @@ fn init_id_map() -> FxHashMap<Cow<'static, str>, usize> {
map.insert("not-displayed".into(), 1);
map.insert("alternative-display".into(), 1);
map.insert("search".into(), 1);
map.insert("search-helper".into(), 1);
// This is the list of IDs used in HTML generated in Rust (including the ones
// used in tera template files).
map.insert("mainThemeStyle".into(), 1);
Expand Down
45 changes: 42 additions & 3 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ table,
font-weight: 500;
margin-bottom: 20px;
}
#crate-search {
#crate-search, #search-helper select {
min-width: 115px;
margin-top: 5px;
padding-left: 0.3125em;
Expand All @@ -971,7 +971,7 @@ table,
.search-container {
margin-top: 4px;
}
.search-input {
.search-input, #search-helper input:not([type="checkbox"]), #search-helper button {
/* Override Normalize.css: it has a rule that sets
-webkit-appearance: textfield for search inputs. That
causes rounded corners and no border on iOS Safari. */
Expand All @@ -990,6 +990,45 @@ table,
width: 100%;
}

#search-helper {
margin-top: 6px;
}
#search-helper summary {
font-size: 1.15rem;
}
#search-helper select {
padding-top: 4px;
padding-bottom: 4px;
margin-bottom: 5px;
}
#search-helper .end-buttons {
padding-top: 5px;
}
#search-helper select, #search-helper button, #search-helper summary {
cursor: pointer;
}
#search-helper > *:not(input) {
width: 100%;
}
#search-helper .search-buttons {
display: flex;
}
#search-helper .search-returned, #search-helper .search-arguments {
margin: 15px 0;
}
#search-helper .search-arguments > *, #search-helper .search-returned > *, #search-helper .search-buttons {
margin-top: 5px;
}
#search-helper .search-buttons button:not(:last-of-type) {
margin-right: 5px;
}
#search-helper .generics {
padding-left: 14px;
}
#search-helper .search-literal, #search-helper .search-literal > * {
cursor: pointer;
}

.search-results {
display: none;
padding-bottom: 2em;
Expand Down Expand Up @@ -2110,7 +2149,7 @@ in storage.js plus the media query with (min-width: 701px)
width: 50%;
}

#crate-search {
#crate-search, #search-helper select {
border-radius: 4px;
}

Expand Down
11 changes: 8 additions & 3 deletions src/librustdoc/html/static/css/themes/ayu.css
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,18 @@ details.rustdoc-toggle > summary::before {
filter: invert(100%);
}

#crate-search, .search-input {
#crate-search, .search-input, #search-helper input, #search-helper button, #search-helper select {
background-color: #141920;
}

#crate-search {
/* Without the `!important`, the border-color is ignored for `<select>`... */
border-color: #424c57 !important;
}

.search-input {
.search-input, #search-helper input, #search-helper button, #search-helper select {
color: #ffffff;
border-color: #424c57;
}

.module-item .stab,
Expand Down Expand Up @@ -486,7 +490,8 @@ kbd {
}

#settings-menu > a:hover, #settings-menu > a:focus,
#help-button > button:hover, #help-button > button:focus {
#help-button > button:hover, #help-button > button:focus,
#search-helper button:focus, #search-helper button:hover {
border-color: #e0e0e0;
}

Expand Down
12 changes: 8 additions & 4 deletions src/librustdoc/html/static/css/themes/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,21 @@ details.rustdoc-toggle > summary::before {
filter: invert(100%);
}

#crate-search, .search-input {
#crate-search, .search-input, #search-helper input, #search-helper button, #search-helper select {
color: #111;
background-color: #f0f0f0;
}

#crate-search {
/* Without the `!important`, the border-color is ignored for `<select>`... */
border-color: #f0f0f0 !important;
}

.search-input {
.search-input, .search-input, #search-helper input, #search-helper button {
border-color: #e0e0e0;
}

.search-input:focus {
.search-input:focus, #search-helper input:focus {
border-color: #008dfd;
}

Expand Down Expand Up @@ -325,7 +328,8 @@ kbd {
}

#settings-menu > a:hover, #settings-menu > a:focus,
#help-button > button:hover, #help-button > button:focus {
#help-button > button:hover, #help-button > button:focus,
#search-helper button:focus, #search-helper button:hover {
border-color: #ffb900;
}

Expand Down
10 changes: 7 additions & 3 deletions src/librustdoc/html/static/css/themes/light.css
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,16 @@ details.rustdoc-toggle > summary::before {
color: #999;
}

#crate-search, .search-input {
#crate-search, .search-input, #search-helper input, #search-helper button, #search-helper select {
background-color: white;
}

#crate-search {
/* Without the `!important`, the border-color is ignored for `<select>`... */
border-color: #e0e0e0 !important;
}

.search-input:focus {
.search-input:focus, #search-helper input:focus {
border-color: #66afe9;
}

Expand Down Expand Up @@ -308,7 +311,8 @@ kbd {
}

#settings-menu > a:hover, #settings-menu > a:focus,
#help-button > button:hover, #help-button > button:focus {
#help-button > button:hover, #help-button > button:focus,
#search-helper button:focus, #search-helper button:hover {
border-color: #717171;
}

Expand Down
Loading