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: use a button instead of a bar for search #133279

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

notriddle
Copy link
Contributor

r? @GuillaumeGomez

CC @lolbinarycat @liigo

This is an attempt to address three complaints:

  1. The header area takes up a lot of vertical space, and is generally quite "heavy" feeling.

    Fixes [rustdoc] issues of the three-big-buttons #132386

  2. Back and forward are kind of wacky, because there's no "single source of truth" for whether the search mode is open or not. Can't find an issue, but here's a screen recording where I reproduce it.

    screen-record-history-bug.mp4
  3. You can't see the crate picker list, or anything else that we might want to show you, until after you've already typed your search term. [rustdoc search] allow setting crates to search in before showing results #129537 (also notice the example searches, which exist in Hoogle and this tweak adds)

Preview page: https://notriddle.com/rustdoc-html-demo-15/search-button/std/index.html

Video:

screen-record.mp4

Screenshot:

image

image

This is a response to complaints that the header area takes up
too much vertical space, forcing the user to scroll more than
they ought to need. It also adds a reasonable way to pick the
crate name before actually searching, which was also a feature
that people ask for.
@rustbot rustbot added 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. labels Nov 21, 2024
@rust-log-analyzer

This comment has been minimized.

@lolbinarycat
Copy link
Contributor

My immediate concern is how this will look on mobile, expecially with long crate names.

the status quo is already pretty bad.

Screenshot_20241121-005613

@GuillaumeGomez
Copy link
Member

I'm not too sure what to think about it. Turning the search input into a button (to make the search input appear) makes it more tricky to access the search feature.

Also, on mobile it's really not great as the space available is very little.

However I like a few things from this PR:

  1. When we focus on the search focus, we enter the "search page" which allows to give more information to the users.
    • However, on mobile we need a button to leave this "search page"
  2. I like the new layout of the search with the crates filter dropdown above the search input

@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
info: ES-Check: there were no ES version matching errors!  🎉
+ eslint -c ../src/librustdoc/html/static/.eslintrc.js ../src/librustdoc/html/static/js/externs.js ../src/librustdoc/html/static/js/main.js ../src/librustdoc/html/static/js/scrape-examples.js ../src/librustdoc/html/static/js/search.js ../src/librustdoc/html/static/js/settings.js ../src/librustdoc/html/static/js/src-script.js ../src/librustdoc/html/static/js/storage.js

/checkout/src/librustdoc/html/static/js/search.js
  4459:25  error  'getVar' is not defined  no-undef

✖ 1 problem (1 error, 0 warnings)
  local time: Thu Nov 21 16:20:43 UTC 2024
  network time: Thu, 21 Nov 2024 16:20:43 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

[rustdoc] issues of the three-big-buttons
5 participants