-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 crate selection on rustdoc search results page #98855
Improve crate selection on rustdoc search results page #98855
Conversation
Some changes occurred in HTML/CSS/JS. cc @GuillaumeGomez, @Folyd, @jsha |
r? @jsha (rust-highfive has picked a reviewer for you, use r? to override) |
6a8b87f
to
7e24601
Compare
I uploaded an online version of this change here. I'm personally not a big fan of putting the "in X" part in its own line but let's see what others think about it. |
The thing you uploaded only has a single crate, so the list doesn’t show up in the first place. It did however remind me that in that case, the |
7e24601
to
2a19120
Compare
Didn't even pay attention to that, sorry. Fixed it. |
I agree with @GuillaumeGomez that we shouldn't use a second line of vertical space. @steffahn you commented in #93240 that you are indifferent to whether the results page echoes the search query. I think that might be a better solution than using a second line; let's remove the "for |
Okay, keeping it in the title and removing the search term; making the With a single crate, the thing would just say Results. |
Makes me reconsider perhaps also addressing the other point I made in #93240 here, the high contrast in the dark theme currently. Is there any other dropdown-selections in rustdoc that should be taken into consideration for consistency? I’m also noticing that “all crates” is probably more sensible than “All crates” in this position. |
I added an implementation of a style along those lines, i.e. as explained in my previous two comments. As you might be able to tell by looking into the CSS, I had a hard time adapting the color of that arrow to the field; I’m open for suggestions for cleaner approaches if an inline svg like this is not acceptable. |
A change occurred in the Ayu theme. cc @Cldfire Some changes occurred in HTML/CSS themes. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
d5c0b07
to
0f6a9c9
Compare
This comment has been minimized.
This comment has been minimized.
Just realized that if you don't need to use |
That seems very weird to switch the "focus" from the main content to the sidebar, no? |
I have yet to find out why the thing has so much more visual padding in the If anyone has an idea, feel free to share it. |
This comment has been minimized.
This comment has been minimized.
I’ve disabled the abovementioned failing (still rather new) tests for now1; if it’s okay to have them only come back in a future PR, then this PR should be ready to be reviewed and merged from my end, provided CI passes now 🚀 Footnotes
|
Resolves all of issue rust-lang#93240 Reproduces a similar change as rust-lang#99086, but with improvements In particular, this PR inlcludes: * redesigning the crate-search selector so the background color matches its surroundings * decrease the font of the dropdown menu to a reaonable size * add a hover effect * make the color of the arrow theme-dependent, using a surrounding div, with :after pseudo-element that can then be transformed using CSS filters to approximate the desired color * fix the text "in" to match the title font * remove the "for xyz" in the "Results for xyz in [All crates]" title when searching for search term "xyz"; you can already see what you're searching for as it's typed in the search bar! * in line with rust-lang#99086, handle super-long crate names appropriately without a long <select> element escaping the screen area; the improvement is that we also keep the title within a single line now; uses some flex layout shenanigans... * the margins / paddings are adjusted so the selected label of the <select> fits within the rest of that title nicely; also some inconsistency in the way that Firefox renders a <select> with "appearance: none" (roughly 4px more padding left and right of the text than e.g. Chrome) is worked around, and it now produces a result that looks (essentially) identical to Chrome * the color of the help menu and settings menu border in light theme is made to match with the color of the corresponding buttons, like they do (match) in the ayu theme * the casing of "All crates" changes to "all crates" * the new tests from rust-lang#99086 are temporarily disabled, until they can be adapted later
45bc004
to
ac20976
Compare
@@ -934,14 +949,35 @@ table, | |||
-webkit-appearance: none; | |||
/* Removes default arrow from firefox */ | |||
text-indent: 0.01px; | |||
text-overflow: ""; | |||
} | |||
/* cancel stylistic differences in padding |
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 does it happen? We don't use appearance: none
ourselves after all.
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.
I think we effectively are, kind-of… I guess… at least with appearance: none
it looks the same, IDK about backwards-compatibility with older versions of Firefox where it might’ve been different..?
In any case, what this is supposed to say is that Firefox has some (empirically, 4px) padding in an "unstyled" (i.e. when the native arrow is removed) that Chrome doesn't have. I don't have any other browsers myself ATM to test / compare. Admitted, given that appearance: none is not literally what’s used here, the comment could be clarified.
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.
I changed the wording a bit now.
I’m not sure about the pros and cons of using the “actual” appearance: none
property, I haven’t researched too much what distinguishes this property from those -moz-appearance
/ -webkit-appearance
ones; consequently I kept everything as-is with regards to these properties, just to be safe, e.g. since I haven’t tested other browsers, etc…
"#search-settings .search-results-title", | ||
{"y": 5}, | ||
) | ||
// FIXME: Fix and re-enable these tests! |
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.
So about the goml
format. It's something I wrote to make it easy to write/read. You can see more information about it (with the full list of commands) here.
We can take a look at the |
Fix oversight duplicate property left in CSS (dark theme). Improve wording in comment that mentions `appearance: none`
64530d7
to
8b190b4
Compare
Well for one thing, I’d need to get those tests running locally in the first place, otherwise it’s impossible to work with. It just gives me a completely cryptic error message
I’m also noticing this warning on the
I have no idea if that’s related to the problem and if yes how to fix it. |
Ah I see, like that:
Normally you have the explanations in |
W.r.t. rewriting/adapting the tests, they currently (judging by the comments) seem to work with the implicit assumption that the I also don’t know what this In terms of tests, one could perhaps also want to test that |
Ah, that works… but it gives an unrelated failure of a test that doesn’t appear to fail in CI
oh, well, I guess I can just ignore that problem. |
TBH, I don’t have much more time I can spend on this today. I would highly appreciate if I didn’t have to learn this whole testing infrastructure now, too. This PR is already so much more that I initially wanted to do. Learning new HTML and CSS fundamentals I didn’t know before is enough commitment for my liking, I don’t feel like going too deep into this whole testing framework, too, now. |
I can do this part then. |
☔ The latest upstream changes (presumably #99346) made this pull request unmergeable. Please resolve the merge conflicts. |
I took the commits from here, fixed the conflicts and added the missing GUI tests in #100374. |
…rch_results_page_crates_selection, r=notriddle Improve crate selection on rustdoc search results page Take over of rust-lang#98855 (screenshots and explanations are there). You can test it [here](https://rustdoc.crud.net/imperio/improve_rustdoc_search_results_page_crates_selection/std/index.html?search=test). cc `@steffahn` `@jsha` r? `@notriddle`
…rch_results_page_crates_selection, r=notriddle Improve crate selection on rustdoc search results page Take over of rust-lang#98855 (screenshots and explanations are there). You can test it [here](https://rustdoc.crud.net/imperio/improve_rustdoc_search_results_page_crates_selection/std/index.html?search=test). cc ``@steffahn`` ``@jsha`` r? ``@notriddle``
Looks like at some point Firefox must have changed, at least my Firefox browser no longer shows the differences that used to be compensated with the /* cancel stylistic differences in padding in firefox
for "appearance: none"-style (or equivalent) <select>s */
@-moz-document url-prefix() {
#crate-search {
padding-left: 0px; /* == 4px - 4px */
padding-right: 19px; /* == 23px - 4px */
}
} part, hence that can (and should) probably be removed. I’ll need to look into this more, and create an appropriate new issue and PR if this is really the case. (Makes me wonder whether there are good ways to do something like “display a website for a bunch of different versions of Firefox” in order to confirm that there really was a change at some version throughout the last year, and I’m not the one that changed a factor. |
I was wondering the same thing a few days ago. Don't hesitate to send a PR in any case! As for checking on different firefox versions, I remember that websites allow it, but don't remember the name. ^^' |
I didn’t find any websites easily. I’ll just ignore the urge to conclusively “prove” something in Firefox has changed, and just go with the observation that both on my PC and phone, the current Firefox seems to be displaying it differently than intended and removing the special case workaround CSS code seems like the way to fix it. So I’ll just open a PR tomorrow. :-) |
Perfect, thanks! |
…ctor-padding, r=GuillaumeGomez Remove outdated Firefox-specific CSS for search's crate selector appearance Remove adjustments that used to be necessary for search's crate selector appearance (padding) to look identical on Firefox. New versions of Firefox appear to have changed behavior to agree with Chrome. As briefly discussed in rust-lang#98855 (comment) r? `@GuillaumeGomez`
…ctor-padding, r=GuillaumeGomez Remove outdated Firefox-specific CSS for search's crate selector appearance Remove adjustments that used to be necessary for search's crate selector appearance (padding) to look identical on Firefox. New versions of Firefox appear to have changed behavior to agree with Chrome. As briefly discussed in rust-lang#98855 (comment) r? ``@GuillaumeGomez``
Improves some problems pointed out in #93240.
In particular the
in
being serif-font makes sense once this is in a new line, and the font-size is better so the dropdown menu isn’t this huge anymore. This also addresses my concern that the selection moves around horizontally as the search term changes.The formatting for the
#search-settings
CSS is not necessary for the title, becauseh1
has the same CSS, too, anyways.Currently on nightly:
After this PR:(outdated, see below)With my latest changes added, I'd say this PR can close #93240 entirely. See #98855 (comment) below to see renderings of the current status.