Skip to content
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

rustdoc: fixes #64305: disable search field instead of hidding it #66298

Merged
merged 2 commits into from
Nov 20, 2019
Merged
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
3 changes: 2 additions & 1 deletion src/librustdoc/html/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ pub fn render<T: Print, S: Print>(
</div>\
<script src=\"{static_root_path}theme{suffix}.js\"></script>\
<nav class=\"sub\">\
<form class=\"search-form js-only\">\
<form class=\"search-form\">\
<div class=\"search-container\">\
<div>{filter_crates}\
<input class=\"search-input\" name=\"search\" \
disabled \
autocomplete=\"off\" \
spellcheck=\"false\" \
placeholder=\"Click or press ‘S’ to search, ‘?’ for more options…\" \
Expand Down
8 changes: 4 additions & 4 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,6 @@ function getSearchElement() {
var TY_PRIMITIVE = itemTypes.indexOf("primitive");
var TY_KEYWORD = itemTypes.indexOf("keyword");

onEachLazy(document.getElementsByClassName("js-only"), function(e) {
removeClass(e, "js-only");
});

function getQueryStringParams() {
var params = {};
window.location.search.substring(1).split("&").
Expand Down Expand Up @@ -2626,6 +2622,10 @@ function getSearchElement() {
option.innerText = crates_text[i];
elem.appendChild(option);
}

if (search_input) {
search_input.removeAttribute('disabled');
};
}

window.addSearchOptions = addSearchOptions;
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ nav.sub {

/* Everything else */

.js-only, .hidden {
.hidden {
display: none !important;
}

Expand Down
4 changes: 4 additions & 0 deletions src/librustdoc/html/static/themes/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ a.test-arrow {
border-color: #008dfd;
}

.search-focus:disabled {
background-color: #c5c4c4;
}

#crate-search + .search-input:focus {
box-shadow: 0 0 8px 4px #078dd8;
}
Expand Down
4 changes: 4 additions & 0 deletions src/librustdoc/html/static/themes/light.css
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ a.test-arrow {
border-color: #66afe9;
}

.search-focus:disabled {
background-color: #e6e6e6;
}

#crate-search + .search-input:focus {
box-shadow: 0 0 8px #078dd8;
}
Expand Down