Skip to content

Commit 5cbd406

Browse files
Ppjet6GuillaumeGomez
authored andcommitted
rustdoc: fixes #64305: disable search field instead of hidding it
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
1 parent 9b0214d commit 5cbd406

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/librustdoc/html/layout.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,11 @@ pub fn render<T: Print, S: Print>(
8686
</div>\
8787
<script src=\"{static_root_path}theme{suffix}.js\"></script>\
8888
<nav class=\"sub\">\
89-
<form class=\"search-form js-only\">\
89+
<form class=\"search-form\">\
9090
<div class=\"search-container\">\
9191
<div>{filter_crates}\
9292
<input class=\"search-input\" name=\"search\" \
93+
disabled \
9394
autocomplete=\"off\" \
9495
spellcheck=\"false\" \
9596
placeholder=\"Click or press ‘S’ to search, ‘?’ for more options…\" \

src/librustdoc/html/static/main.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,6 @@ function getSearchElement() {
142142
var TY_PRIMITIVE = itemTypes.indexOf("primitive");
143143
var TY_KEYWORD = itemTypes.indexOf("keyword");
144144

145-
onEachLazy(document.getElementsByClassName("js-only"), function(e) {
146-
removeClass(e, "js-only");
147-
});
148-
149145
function getQueryStringParams() {
150146
var params = {};
151147
window.location.search.substring(1).split("&").
@@ -2626,6 +2622,10 @@ function getSearchElement() {
26262622
option.innerText = crates_text[i];
26272623
elem.appendChild(option);
26282624
}
2625+
2626+
if (search_input) {
2627+
search_input.removeAttribute('disabled');
2628+
};
26292629
}
26302630

26312631
window.addSearchOptions = addSearchOptions;

src/librustdoc/html/static/rustdoc.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ nav.sub {
197197

198198
/* Everything else */
199199

200-
.js-only, .hidden {
200+
.hidden {
201201
display: none !important;
202202
}
203203

0 commit comments

Comments
 (0)