Move crate drop-down to search results page by jsha · Pull Request #92490 · rust-lang/rust (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation21 Commits2 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

jsha

@rust-highfive

@rustbot rustbot added the T-rustdoc

Relevant to the rustdoc team, which will review and decide on the PR/issue.

label

Jan 2, 2022

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@jsha jsha mentioned this pull request

Jan 2, 2022

8 tasks

GuillaumeGomez

@@ -1126,9 +1126,16 @@ window.initSearch = function(rawSearchIndex) {
}
}
var output = "

Results for " + escape(query.query) +

let crates = ``;

Choose a reason for hiding this comment

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

Isn't eslint complaining when you use backticks without ${} content?

Choose a reason for hiding this comment

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

Nope! I wouldn't expect it to. Backticks do a bunch of things besides template expansion. They also allow multiline strings, and serve as a different delimiter so you don't have to backslash double quotes (\")

@GuillaumeGomez

As said previously, I really like it! The display needs a bit of improvement: the in is too small I think (but maybe it's voluntary?). Maybe we should force the dropdown to be on its own line on mobile? Currently it gives (with long search string):

Screenshot from 2022-01-02 18-09-51

The style of the dropdown is incomplete I think: the border is looking strange.

In any case, it's a nice start. :)

@jsha

the in is too small I think (but maybe it's voluntary?).

This was on purpose, since in ____ isn't part of the title (<h1>). But I could make it the same size as the <h1>, just outside the tag? I don't have a strong opinion about what's better.

Maybe we should force the dropdown to be on its own line on mobile?

Good idea.

@camelid

I also had an idea recently that could help with this (I forget if I mentioned it or not). We could add a crate:some_crate search syntactical form. Then we could add it as an option to the advanced search builder @jsha proposed.

@camelid

This was on purpose, since in ____ isn't part of the title (<h1>). But I could make it the same size as the <h1>, just outside the tag? I don't have a strong opinion about what's better.

It looks very strange to me. The select also renders differently from how it used to:

image

The bezel seems a bit extreme.

@jsha

@camelid

@jsha

Alright, I've increased the size of in and fixed the border issue (I had overzealously removed a border:0 in the CSS that turned out to be needed). I also tweaked the padding slightly. Demo is pushed and ready for another look!

@rust-log-analyzer

This comment has been minimized.

@jsha jsha mentioned this pull request

Jan 5, 2022

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

GuillaumeGomez

(query.type ? " (type: " + escape(query.type) + ")" : "") + "" +
"<div id=\"titles\">" +
` in ${crates} ` +
"<div id=\"titles\">" +

Choose a reason for hiding this comment

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

I think backticks would be better here as well.

GuillaumeGomez

@@ -40,5 +40,5 @@ ENV SCRIPT python3 ../x.py --stage 2 test src/tools/expand-yaml-anchors && \
/scripts/validate-toolstate.sh && \
/scripts/validate-error-codes.sh && \
# Runs checks to ensure that there are no ES5 issues in our JS code.
es-check es5 ../src/librustdoc/html/static/js/*.js && \
es-check es6 ../src/librustdoc/html/static/js/*.js && \

Choose a reason for hiding this comment

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

We wanted to make this change in bigger PR but I guess it's fine... Don't forget to update the comment just above please.

Choose a reason for hiding this comment

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

I actually think a giant PR adding ES6 features wherever possible, and updating the linter at the same time would be a bad idea. The way we should do it is like I'm doing here:

Choose a reason for hiding this comment

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

Like I said, it's fine. 😉

@jsha

Also update Node to v16.9.0, es-check to 6.1.1, and eslint to 8.6.0.

@jsha

This reduces clutter on doc pages.

GuillaumeGomez

@GuillaumeGomez

@bors

📌 Commit 8abb4bb 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-review

Status: Awaiting review from the assignee but also interested parties.

labels

Jan 5, 2022

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

Jan 5, 2022

@matthiaskrgr

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

Jan 6, 2022

@matthiaskrgr

bors added a commit to rust-lang-ci/rust that referenced this pull request

Jan 9, 2022

@bors

…askrgr

Rollup of 8 pull requests

Successful merges:

Failed merges:

r? @ghost @rustbot modify labels: rollup

Labels

A-rustdoc-ui

Area: Rustdoc UI (generated HTML)

S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

T-rustdoc

Relevant to the rustdoc team, which will review and decide on the PR/issue.