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

Automatically jump to the first result when entering directly in the search form #84286

Closed

Conversation

Rustin170506
Copy link
Member

@rust-highfive
Copy link
Collaborator

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez

@rust-highfive
Copy link
Collaborator

r? @ollie27

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 18, 2021
@Rustin170506 Rustin170506 marked this pull request as draft April 18, 2021 03:33
@Rustin170506 Rustin170506 marked this pull request as ready for review April 18, 2021 04:12
@Rustin170506 Rustin170506 changed the title Automatically jump to the first result when entering directly in the search form Automatically enter to the first result when entering directly in the search form Apr 18, 2021
@Rustin170506 Rustin170506 changed the title Automatically enter to the first result when entering directly in the search form Automatically jump to the first result when entering directly in the search form Apr 18, 2021
@Rustin170506
Copy link
Member Author

A simple demo:

Screen.Recording.2021-04-18.at.12.20.06.PM.mov

@GuillaumeGomez
Copy link
Member

I don't find this behaviour very intuitive...

What do you think @rust-lang/rustdoc ?

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

jyn514 commented Apr 18, 2021

I like it; I think it makes it easier to navigate the docs. Normally enter would start a new search, but because rustdoc searches while you're typing, I don't think that's super useful.

@Rustin170506
Copy link
Member Author

I think this is acceptable, we already use use the enter to jump pages (instead of searching), then I think it is acceptable to jump to the first result by default.

@GuillaumeGomez
Copy link
Member

I think this is acceptable, we already use use the enter to jump pages (instead of searching)

Where do we do that?

@Rustin170506
Copy link
Member Author

I think this is acceptable, we already use use the enter to jump pages (instead of searching)

Where do we do that?

When we move up and down with the keyboard, we can jump with a return.

@GuillaumeGomez
Copy link
Member

Yes, but it's after the user hovers an element (either with the mouse or with up/down arrows). The action is then obvious.

Oh also, since you know well about UX, what do you think @jsha ?

@Manishearth
Copy link
Member

I'm fine with this if off by default; it does seem like an improvement over the original feature.

Note that it'll probably directly match usize and modules and stuff (std::vec gets matched before std::vec::Vec)

Very reluctant to make the search page do stuff like this by default; because a state change like that is usually kinda jarring

@GuillaumeGomez
Copy link
Member

If it's done with a setting like @Manishearth suggested (disabled by default), I'm fine with it.

@jsha
Copy link
Contributor

jsha commented Apr 18, 2021

Thanks for the tag, @GuillaumeGomez. I posted some thoughts on the issue thread at #84214 (comment)

@bors
Copy link
Contributor

bors commented Apr 24, 2021

☔ The latest upstream changes (presumably #84490) made this pull request unmergeable. Please resolve the merge conflicts.

@Rustin170506
Copy link
Member Author

@GuillaumeGomez @jyn514 @jsha What do you think about changing the feature to default highlighting the first result?

@GuillaumeGomez
Copy link
Member

There is #84462 coming up, so in this context, I don't know how this PR could work...

@Rustin170506
Copy link
Member Author

There is #84462 coming up, so in this context, I don't know how this PR could work...

Got it. So let's wait for that PR to merge and then we'll see how to solve this problem.

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-review Status: Awaiting review from the assignee but also interested parties. 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.

8 participants