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

Conversation

Ppjet6
Copy link
Contributor

@Ppjet6 Ppjet6 commented Nov 11, 2019

The result seems to be ok but I wasn't entirely sure how to get there. I tried to stay generic a bit but maybe it's not required at all.

@GuillaumeGomez

Signed-off-by: Maxime “pep” Buquet pep@bouah.net

src/librustdoc/html/layout.rs Outdated Show resolved Hide resolved
src/librustdoc/html/static/main.js Outdated Show resolved Hide resolved
src/librustdoc/html/static/main.js Outdated Show resolved Hide resolved
@Dylan-DPC-zz
Copy link

r? @GuillaumeGomez

onEachLazy(document.getElementsByClassName("js-only"), function(e) {
removeClass(e, "js-only");
onEachLazy([getSearchInput()], function(e) {
e.removeAttribute('disabled');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please move this block in the function addSearchOptions? I just realized that there is no point into enabling the search bar if the content wasn't loaded yet.

@@ -142,8 +142,8 @@ 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");
onEachLazy([getSearchInput()], function(e) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also: no need anymore for onEachLazy: just grab the output of getSearchOutput and use it:

var e = getSearchInput();
if (e) {
    e.removeAttribute('disabled');
}

@hdhoang hdhoang added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Nov 14, 2019
@@ -2627,6 +2623,11 @@ function getSearchElement() {
option.innerText = crates_text[i];
elem.appendChild(option);
}

var e = getSearchInput();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this stage, I think you can used the search_input variable created at line 83. Otherwise, seems all good to me, thanks a lot!


if (search_input) {
search_input.removeAttribute('disabled');
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent issue. :p

@GuillaumeGomez
Copy link
Member

Thanks! I confirm that it works locally.

I added a commit to change the background color if the search input is disabled.

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Nov 20, 2019

📌 Commit 5721338 has been approved by GuillaumeGomez

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 20, 2019
Centril added a commit to Centril/rust that referenced this pull request Nov 20, 2019
…laumeGomez

rustdoc: fixes rust-lang#64305: disable search field instead of hidding it

The result seems to be ok but I wasn't entirely sure how to get there. I tried to stay generic a bit but maybe it's not required at all.

@GuillaumeGomez

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
bors added a commit that referenced this pull request Nov 20, 2019
Rollup of 7 pull requests

Successful merges:

 - #66060 (Making ICEs and test them in incremental)
 - #66298 (rustdoc: fixes #64305: disable search field instead of hidding it)
 - #66457 (Just derive Hashstable in librustc)
 - #66496 (rustc_metadata: Privatize more things)
 - #66514 (Fix selected crate search filter)
 - #66535 (Avoid ICE when `break`ing to an unreachable label)
 - #66573 (Ignore run-make reproducible-build-2 on Mac)

Failed merges:

r? @ghost
@bors bors merged commit 5721338 into rust-lang:master Nov 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants