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

Improve search result tab handling #80382

Merged
merged 1 commit into from
Jan 19, 2021

Conversation

GuillaumeGomez
Copy link
Member

Fixes #80378.

If the current search result tab is empty, it picks the first non-empty one. If all are empty, the current one doesn't change. It can be tested with "-> string" (where only the "returned elements" tab is not empty).

r? @jyn514

@rust-highfive
Copy link
Collaborator

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 26, 2020
@pickfire
Copy link
Contributor

Do you have some examples on the behavior after this patch? Or if there is any weird cases when people remove characters from search result? Or if people specifically select a tab then it switch away automatically which confuses others?

@jyn514 jyn514 added A-rustdoc-ui Area: Rustdoc UI (generated HTML) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Dec 27, 2020
@GuillaumeGomez
Copy link
Member Author

Do you have some examples on the behavior after this patch?

I gave one. Test this change with "-> String".

Or if there is any weird cases when people remove characters from search result?

I don't understand the question.

Or if people specifically select a tab then it switch away automatically which confuses others?

It only switches automatically when you perform a new search if the current tab is empty and one of the others isn't.

@pickfire
Copy link
Contributor

pickfire commented Dec 27, 2020

Or if there is any weird cases when people remove characters from search result?

I don't understand the question.

First, when you search "-> string", then you search "hello -> string", would the tab page changed?

What if people search "string", click on "In Parameters" tab, and then search "-> string"? Would it be "In Paremeters" tab or "In Return Types" tab?

@GuillaumeGomez
Copy link
Member Author

It's being done when the search results are displayed, so if you are on the "Parameters" tab and make a new search with no results in this tab but with results in another, it'll change the current tab (but only if at least one other tab isn't empty).

If you're suggesting that in case we are already on the search results page, we don't want to switch the current tab if we make another search, I can update the PR to take it into account. Did I understand you correctly and does this suggestion seems good to you? To you too maybe @jyn514 ?

@jyn514
Copy link
Member

jyn514 commented Dec 30, 2020

If you're suggesting that in case we are already on the search results page, we don't want to switch the current tab if we make another search, I can update the PR to take it into account. Did I understand you correctly and does this suggestion seems good to you? To you too maybe @jyn514 ?

I don't think we should keep state from the previous search; changing to the new tab seems fine to me. You can always navigate back to the empty tab if you really wanted to be there.

The implementation looks fine to me, but I'd prefer to get a second opinion on the change in behavior - @Manishearth what do you think?

…ty one. If all are empty, the current one doesn't change.
Copy link
Contributor

@pickfire pickfire left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@jyn514
Copy link
Member

jyn514 commented Jan 19, 2021

r? @Nemo157

@GuillaumeGomez
Copy link
Member Author

@bors: r=Nemo157,pickfire rollup

@bors
Copy link
Contributor

bors commented Jan 19, 2021

📌 Commit 3337767 has been approved by Nemo157,pickfire

@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 19, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 19, 2021
…laumeGomez

Rollup of 8 pull requests

Successful merges:

 - rust-lang#80382 (Improve search result tab handling)
 - rust-lang#81112 (Remove unused alloc::std::ops re-export.)
 - rust-lang#81115 (BTreeMap: prefer bulk_steal functions over specialized ones)
 - rust-lang#81147 (Fix structured suggestion for explicit `drop` call)
 - rust-lang#81161 (Remove inline script tags)
 - rust-lang#81164 (Fix typo in simplify.rs)
 - rust-lang#81166 (remove some outdated comments regarding  debug assertions)
 - rust-lang#81168 (Fixes rust-lang#81109 - Typo in pointer::wrapping_sub)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 670acf7 into rust-lang:master Jan 19, 2021
@rustbot rustbot added this to the 1.51.0 milestone Jan 19, 2021
@GuillaumeGomez GuillaumeGomez deleted the search-result-tab-picking branch January 19, 2021 15:06
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Apr 2, 2021
…, r=jyn514

Add test to ensure search tabs behaviour

It adds a GUI test for rust-lang#80382.

r? `@jyn514`
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Apr 2, 2021
…, r=jyn514

Add test to ensure search tabs behaviour

It adds a GUI test for rust-lang#80382.

r? ``@jyn514``
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Apr 2, 2021
…, r=jyn514

Add test to ensure search tabs behaviour

It adds a GUI test for rust-lang#80382.

r? ```@jyn514```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When the current search results tab is empty, it should focus on the first non-empty if any
7 participants