-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Simplify and unify rustdoc sidebar styles #92692
Conversation
Some changes occurred in HTML/CSS/JS. |
This comment has been minimized.
This comment has been minimized.
Overall I really like the direction it's taking though. The sidebar looks much cleaner. I don't think you should unify it with the source file viewer sidebar though. They have both very different meaning after all. |
I think it's a distinctly good idea. The current design, where only the hamburger menu floats along with the page, feels very broken to me. And it doesn't make the top 45px usable because it overlaps with some of the body text. Also, the topbar provides useful context about where you are, and quick click targets to go to the root of the module (and, later, to the top of the page - which I'd like to add in a separate PR). |
To put this another way: We should either have a topbar that doesn't follow the scroll, or we should have a topbar where the whole width of it follows the scroll. The current situation, where just the hamburger part of the topbar follows the scroll, is unusual UI and doesn't actually get us more usable viewport.
What platform, and what page? I checked on both mobile and desktop, and it looks right to me. Did you hard-reload?
In dark mode and ayu, I had forgotten to change the display of links to get the link color. Now the version is distinguished from the links.
I tried that earlier. It was cool, but in the end I found that it drew too much attention to the sidebar, when the attention should be on the main content. I'll try to distinguish this with better spacing.
Yes, my goal was not to touch the source view sidebar in this PR (though I think it could use some touch-ups too).
I've confirmed this in Firefox and will fix. |
This comment has been minimized.
This comment has been minimized.
@jsha please rebase instead of merging ;) |
Alright, I've fixed the source sidebar and the hamburger menu in Firefox Mobile. I also made it so a long item name gets wrapped, and cleaned up some dead code. Updated the demo. |
This comment has been minimized.
This comment has been minimized.
@jsha what do you think about #92692 (comment)? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
All source pages on desktop firefox. It was very likely because of the interactions with the hamburger button. It's working fine now. I should have recorded a video, that would helped to see better the issue...
I'm not sure what you by this but as always, very curious of what you have in mind. :) Might be a good idea to add some space after the version number to make "all items" easier to see, no?
👍
Much better indeed!
I confirm that the sidebar "header" was removed on the source pages. 👍 Once you're done with the changes, please add GUI tests for the following things:
And I think that's it? I really can't wait to have all these improvements merged! :D |
☔ The latest upstream changes (presumably #92526) made this pull request unmergeable. Please resolve the merge conflicts. |
Rebased, squashed, and pushed the demo. I think all concerns have been addressed. |
@bors r=GuillaumeGomez rollup |
📌 Commit 9baf6cb388924538147dabe13180b06cc46c0251 has been approved by |
Somehow, this got set to p=1. @bors p=0 |
☔ The latest upstream changes (presumably #93021) made this pull request unmergeable. Please resolve the merge conflicts. |
This switches to just use size, weight, and spacing to distinguish headings in the sidebar. We no longer use boxes, horizontal bars, or centering to distinguish headings. This makes it much easier to understand the hierarchy of headings, and reduces visual noise. I also refactored how the mobile topbar works. Previously, we tried to shift around elements from the sidebar to make the topbar. Now, the topbar gets its own elements, which can be styled on their own. This makes styling and reasoning about those elements simpler. Because the heading font sizes are bigger, increase the sidebar width slightly. As a very minor change, removed version from the "All types" page. It's now only on the crate page.
@bors r=GuillaumeGomez rollup |
📌 Commit 6a5f8b1 has been approved by |
…askrgr Rollup of 9 pull requests Successful merges: - rust-lang#90782 (Implement raw-dylib support for windows-gnu) - rust-lang#91150 (Let qpath contain NtTy: `<$:ty as $:ty>::…`) - rust-lang#92425 (Improve SIMD casts) - rust-lang#92692 (Simplify and unify rustdoc sidebar styles) - rust-lang#92780 (Directly use ConstValue for single literals in blocks) - rust-lang#92924 (Delete pretty printer tracing) - rust-lang#93018 (Remove some unused `Ord` derives based on `Span`) - rust-lang#93026 (fix typo in `max` description for f32/f64) - rust-lang#93035 (Fix stdarch submodule pointing to commit outside tree) Failed merges: - rust-lang#92861 (Rustdoc mobile: put out-of-band info on its own line) r? `@ghost` `@rustbot` modify labels: rollup
…laumeGomez rustdoc mobile: fix scroll offset when jumping to internal id Followup to rust-lang#92692. The semantics of `scroll-margin-top` are a little surprising - the attribute needs to be applied to the element that gets scrolled into the viewport, not the scrolling element. This fixes an issue where clicking on a method (or other item) from the sidebar takes you to a scroll position where the topbar covers up the method name. I'm interested in ideas for how to test this with browser-ui-test, but I think it doesn't yet have what I need. What I need is an assert that `<element>.getBoundingClientRect().y` is > 45. Demo: https://rustdoc.crud.net/jsha/fix-scroll-padding-top/std/string/struct.String.html#method.extend_from_within r? `@GuillaumeGomez`
I have to say that I really dislike the new style, especially in dark mode. It is much less accessible than previous style.
Overall for documentation I think accessibility, clarity and easiness to navigate is much more important than style discrepencies. |
There is #93231 open to reduce this issue. Does it improve your situation? |
It certainly helps with the contrast issue. But I still think the old UI style is much more usable and pragmatic. I suggest that an user survey to be performed for such a major UI change. |
Our goal with this change was to make the sidebar easier to use and less cluttered, but I agree that some changes may have made it worse. I do think that decreasing padding and finding a way to increase distinctions between different components of the sidebar would be good. The |
FYI, the vertical spacing is precisely the same before and after: The left margin went from to 10px to 24px. However, the max width of the sidebar went from 200px to 250px. As a result, more of the method names are visible than before. There is indeed a bug with wrapping / ellipsis, which I think was introduced in a different change. I'll send a patch for that shortly. |
I use a vertically oriented display for doc viewing, so the added left margin means less horizontal space for the content. Perhaps the left margin should be adaptive to the screen width? |
I personally think that changing the color to be yellow is fine (though i prefer white). However i really dislike the removal of the separator lines, i.e. the border around the struct name and the lines around |
I confirm. The new UI looks as a regression, it's just plain flat. Not that the old UI was perfect, but it was consistent across Rust versions with gradual QOL improvements. I've created #95816 as a regression report and then was pointed out to this PR. |
Fixes #59860
This switches to just use size, weight, and spacing to distinguish headings in the sidebar. We no longer use boxes, horizontal bars, or centering to distinguish headings. This makes it much easier to understand the hierarchy of headings, and reduces visual noise.
I also refactored how the mobile topbar works. Previously, we tried to shift around elements from the sidebar to make the topbar. Now, the topbar gets its own elements, which can be styled on their own. This makes styling and reasoning about those elements simpler.
Because the heading font sizes are bigger, increase the sidebar width slightly.
As a very minor change, removed version from the "All types" page. It's now only on the crate page.
struct - https://rustdoc.crud.net/jsha/cool-sidebar/std/vec/struct.Vec.html
trait - https://rustdoc.crud.net/jsha/cool-sidebar/std/io/trait.Read.html
crate - https://rustdoc.crud.net/jsha/cool-sidebar/std/index.html
mod - https://rustdoc.crud.net/jsha/cool-sidebar/std/any/index.html
macro - https://rustdoc.crud.net/jsha/cool-sidebar/std/macro.panic.html
fn - https://rustdoc.crud.net/jsha/cool-sidebar/std/io/fn.stdin.html
type alias - https://rustdoc.crud.net/jsha/cool-sidebar/std/io/type.Result.html
keyword - https://rustdoc.crud.net/jsha/cool-sidebar/std/keyword.as.html
primitive - https://rustdoc.crud.net/jsha/cool-sidebar/std/primitive.pointer.html
r? @GuillaumeGomez
cc @camelid
Discussed on Zulip.
Note: This has a lot of smaller commits, but I plan to squash them before merging.