Skip to content

Commit

Permalink
rustdoc: fixes #64305: disable search field instead of hidding it
Browse files Browse the repository at this point in the history
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
  • Loading branch information
Ppjet6 authored and GuillaumeGomez committed Nov 20, 2019
1 parent 9b0214d commit 5cbd406
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
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

0 comments on commit 5cbd406

Please sign in to comment.