-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Fix search results display #85551
Fix search results display #85551
Conversation
Some changes occurred in HTML/CSS/JS. |
I don't think flex is the solution to our problems here. Consider the mobile screenshots below. With flex, we unnecessarily wrap the type really tightly, in a way that's very confusing. One cool side effect of switching from a As the screen gets narrower, first the descriptions on the right should either get hidden or get bumped down to the next line. If they get bumped down to the next line, they should have a bit of left padding to distinguish them from the item names. Then, as the screen gets too narrow even for the item names, we should start wrapping the item names themselves. Note that we have a similar problem for the table layout at the bottom of a module page, where the module links to items inside it (see last screenshot). This PR: nightly: |
display: flex; | ||
} | ||
|
||
.search-results > a > div > div { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we have a series of direct-parent selectors like that, we're creating a brittle dependency on a specific structure of the DOM. It becomes hard to make a change to the code that generates search results and figure out which CSS selectors need to change.
Instead, we should add classes, or use the classes that are already here - result-name
and desc
(though note desc
is on a span rather than a div and might not be exactly what you're looking for).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
The problem is that some paths are really long. I much prefer having them on multiple lines rather than displaying less things. The most important thing for me is to have the items width be the same for all of them (which is why we used a table before). The current display on nightly is really bad in my opinion. I don't mind the current module display but it's up-to-debate. |
Could we improve visibility with something like this? .search-results > a:nth-child(even) { background: rgba(128,128,128, 0.42); } @jsha do I understand you correctly that you suggest an alternating layout. |
I agree the problem is that some paths are really long. That's why I think it's better to use more of the screen width for them on small screens, so there's less wrapping.
Yep.
A mockup: |
I strongly approve this example! |
I like the mockup too 👍 Would extremely long paths (like |
I mocked this up in DevTools so I don't have an easy way to turn it into a patch, but it was very few CSS changes:
|
We can insert |
Making the
@jsha This doesn't work here unfortunately. |
I implemented it (GuillaumeGomez#8) as a pure CSS change because there are some substantial changes in #85540 |
Yeah, I think it looks okay. I am reluctant to add more flexboxes to our layout because I think it is usually more of a fit for application-style layouts and we are emphatically a document-style layout. But it does seem the right tool for the job. The other thought I had was that it would be nice if we could seamlessly switch over to the alternating layout in my mockup, for instance if we detected that any name would wrap. But that would be awkward in the case where (a) you're on a wide desktop screen and (b) only one result has a long name but the others are short. So, let's proceed with this. But can you change the |
I need a new class to remove the deeply nested |
Sure!
Then I'll merge your PR into mine, that seems to be the simplest way. ;) |
Yes, I like merging all the things 👍 |
This comment has been minimized.
This comment has been minimized.
@bors r+ |
📌 Commit 8968c0e has been approved by |
…laumeGomez Rollup of 4 pull requests Successful merges: - rust-lang#85271 (Fix indentation in move keyword documentation) - rust-lang#85551 (Fix search results display) - rust-lang#85621 (Restore sans-serif font for module items.) - rust-lang#85628 (Replace more "NULL" with "null") Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #85544.
cc @dns2utf8
r? @jsha