Skip to content

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

@Ppjet6 Ppjet6 force-pushed the disable-search-field branch from a67c3bd to 09cfb78 Compare November 11, 2019 19:16
@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
@Ppjet6 Ppjet6 force-pushed the disable-search-field branch from 09cfb78 to 0ee15e5 Compare November 15, 2019 13:16
@@ -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!

@Ppjet6 Ppjet6 force-pushed the disable-search-field branch from 0ee15e5 to 2e131ff Compare November 15, 2019 22:12
@Ppjet6 Ppjet6 force-pushed the disable-search-field branch from 2e131ff to 221bcfb Compare November 19, 2019 11:18

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

@Ppjet6 Ppjet6 force-pushed the disable-search-field branch from 221bcfb to 8d4d8f3 Compare November 19, 2019 14:34
@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
Collaborator

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