-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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: clean up source sidebar hide button #119066
rustdoc: clean up source sidebar hide button #119066
Conversation
This is a redesign of the feature, with parts pulled from rust-lang#119049 but with a button that looks more like a button and matches the one used on other sidebar pages.
r? @fmease (rustbot has picked a reviewer for you, use r? to override) |
Some changes occurred in HTML/CSS/JS. cc @GuillaumeGomez, @jsha Some changes occurred in GUI tests. |
This comment has been minimized.
This comment has been minimized.
I found the previous design way more obvious. In this case, nothing indicates that:
Also I really don't like the appearance when sidebar is opened for the title and close button (that is very much personal taste). |
Is this about the empty vertical column when the sidebar is closed, or is it about the icon? I had removed the vertical column because it ate into horizontal screen real estate, which is at a premium since code isn't line wrapped. But if you find that helpful, it could be redesigned to put it back.
The
I'm hoping to lean on people's existing familiarity with GitHub. The fact that this particular icon doesn't seem to have a tooltip in GitHub's design should be criminal, and this PR does include a tooltip for this exact reason. But the icon isn't exactly the same (it's closer to Apple's). |
On mobile the vertical column isn't visible and I think the problem is quite limited on desktop. But yes, I think it'd help to make the connection between the button and the sidebar.
Indeed.
And because of this comment, I just realized that this sidebar could be collapsed. I'm not sure if it's bad UI or just me who's very bad at that... 😅
The button doesn't stand out much either in their case, hence why I never paid attention to it. |
This comment has been minimized.
This comment has been minimized.
969ab31
to
668fe2d
Compare
No problem. I've just pushed a new version of the preview docs and PR with the vertical placeholder column.
Do you think this is because:
|
This comment has been minimized.
This comment has been minimized.
668fe2d
to
bd14fb6
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
It doesn't look quite right, because the lines are too far apart, and it's not going to be announced by screenreaders as a menu button, since that's not what the symbol means. This adds a real tooltip and uses a better drawing of the icon.
8272eae
to
c3e29ea
Compare
Much better for when the sidebar is closed. Now my only question is about the mobile version: currently we can open the sidebar wherever we are on the page. With your change, it's not possible anymore. I think to be taken into consideration as some source code pages can be quite huge and if you're at the bottom, it's quite annoying to go back to the top. And also, it makes the sidebar harder to "discover" if you're not already aware of its existence in this case. Now for when the sidebar is open, I think the title should still be centered and the button remaining on the left side (as currently). You also removed the line which was used as marker to differentiate the "title" and the "content" before. Any reason for that change?
I think it would be already a pretty good improvement. I think it's because there is not a strong enough visual marker that I don't notice it.
Not a strong opinion on this one. But in this case, I think we should use the same icon for both mobile and desktop, whichever it is.
Since you moved it back inside a "column" on desktop, looks good to me. On mobile I still have worries I described above. |
That's odd. What browser are you testing on? The hamburger button is supposed to stick while you scroll, the same way the
I prefer left alignment because the docs sidebar does it the same way.
Not really. If you want it, I'll put it in.
I guess it would need to use a hamburger in on both desktop and mobile, then, since the sidebar icon would be wrong (the file browser fills up the entire screen on mobile, but the icon depicts it as only partially filling the screen). |
After a force refresh, problem gone. All good there. :)
Depends on the "mode": on mobile, the button is on the left and the title is on the right. There is no equivalent for desktop to compare to unfortunately.
Let's see how it looks with it then. 👍
Sounds good to me. |
That's how the top bar looks. I was thinking of the sidebar logo lockup and its headers.
It doesn't sound very good to me, because that icon usually opens a modal instead of toggling a setting. Backing up and trying to think of a different approach, maybe we should use an icon based on its purpose instead of its mechanics, which is the same across all viewport sizes. |
Apart from the question I asked, looks good to me, thanks! Once it's answered, we can start the FCP. |
Time to start the FCP then. @rfcbot fcp merge |
Team member @GuillaumeGomez has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
Interestingly they do have a tooltip on this exact icon in the PR-diff-view. The biggest thing I notice with this (and github's similar button) is that it feels wrong to me that it's on the left, the button to close a panel should be in the top-right. But that's likely platform-specific behavior, and I don't think rustdoc has any similar UI anywhere to be self-consistent with (unlike github which uses top-right-close everywhere I can see except this one panel). |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
@bors r+ |
☀️ Test successful - checks-actions |
Finished benchmarking commit (67b6975): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 666.618s -> 665.69s (-0.14%) |
Not even a change to the |
Pkgsrc changes: * Adapt checksums and patches. Upstream chnages: Version 1.77.0 (2024-03-21) ========================== - [Reveal opaque types within the defining body for exhaustiveness checking.] (rust-lang/rust#116821) - [Stabilize C-string literals.] (rust-lang/rust#117472) - [Stabilize THIR unsafeck.] (rust-lang/rust#117673) - [Add lint `static_mut_refs` to warn on references to mutable statics.] (rust-lang/rust#117556) - [Support async recursive calls (as long as they have indirection).] (rust-lang/rust#117703) - [Undeprecate lint `unstable_features` and make use of it in the compiler.] (rust-lang/rust#118639) - [Make inductive cycles in coherence ambiguous always.] (rust-lang/rust#118649) - [Get rid of type-driven traversal in const-eval interning] (rust-lang/rust#119044), only as a [future compatiblity lint] (rust-lang/rust#122204) for now. - [Deny braced macro invocations in let-else.] (rust-lang/rust#119062) Compiler -------- - [Include lint `soft_unstable` in future breakage reports.] (rust-lang/rust#116274) - [Make `i128` and `u128` 16-byte aligned on x86-based targets.] (rust-lang/rust#116672) - [Use `--verbose` in diagnostic output.] (rust-lang/rust#119129) - [Improve spacing between printed tokens.] (rust-lang/rust#120227) - [Merge the `unused_tuple_struct_fields` lint into `dead_code`.] (rust-lang/rust#118297) - [Error on incorrect implied bounds in well-formedness check] (rust-lang/rust#118553), with a temporary exception for Bevy. - [Fix coverage instrumentation/reports for non-ASCII source code.] (rust-lang/rust#119033) - [Fix `fn`/`const` items implied bounds and well-formedness check.] (rust-lang/rust#120019) - [Promote `riscv32{im|imafc}-unknown-none-elf` targets to tier 2.] (rust-lang/rust#118704) - Add several new tier 3 targets: - [`aarch64-unknown-illumos`] (rust-lang/rust#112936) - [`hexagon-unknown-none-elf`] (rust-lang/rust#117601) - [`riscv32imafc-esp-espidf`] (rust-lang/rust#119738) - [`riscv32im-risc0-zkvm-elf`] (rust-lang/rust#117958) Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support. Libraries --------- - [Implement `From<&[T; N]>` for `Cow<[T]>`.] (rust-lang/rust#113489) - [Remove special-case handling of `vec.split_off (0)`.](rust-lang/rust#119917) Stabilized APIs --------------- - [`array::each_ref`] (https://doc.rust-lang.org/stable/std/primitive.array.html#method.each_ref) - [`array::each_mut`] (https://doc.rust-lang.org/stable/std/primitive.array.html#method.each_mut) - [`core::net`] (https://doc.rust-lang.org/stable/core/net/index.html) - [`f32::round_ties_even`] (https://doc.rust-lang.org/stable/std/primitive.f32.html#method.round_ties_even) - [`f64::round_ties_even`] (https://doc.rust-lang.org/stable/std/primitive.f64.html#method.round_ties_even) - [`mem::offset_of!`] (https://doc.rust-lang.org/stable/std/mem/macro.offset_of.html) - [`slice::first_chunk`] (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.first_chunk) - [`slice::first_chunk_mut`] (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.first_chunk_mut) - [`slice::split_first_chunk`] (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_first_chunk) - [`slice::split_first_chunk_mut`] (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_first_chunk_mut) - [`slice::last_chunk`] (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.last_chunk) - [`slice::last_chunk_mut`] (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.last_chunk_mut) - [`slice::split_last_chunk`] (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_last_chunk) - [`slice::split_last_chunk_mut`] (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.split_last_chunk_mut) - [`slice::chunk_by`] (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.chunk_by) - [`slice::chunk_by_mut`] (https://doc.rust-lang.org/stable/std/primitive.slice.html#method.chunk_by_mut) - [`Bound::map`] (https://doc.rust-lang.org/stable/std/ops/enum.Bound.html#method.map) - [`File::create_new`] (https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.create_new) - [`Mutex::clear_poison`] (https://doc.rust-lang.org/stable/std/sync/struct.Mutex.html#method.clear_poison) - [`RwLock::clear_poison`] (https://doc.rust-lang.org/stable/std/sync/struct.RwLock.html#method.clear_poison) Cargo ----- - [Extend the build directive syntax with `cargo::`.] (rust-lang/cargo#12201) - [Stabilize metadata `id` format as `PackageIDSpec`.] (rust-lang/cargo#12914) - [Pull out as `cargo-util-schemas` as a crate.] (rust-lang/cargo#13178) - [Strip all debuginfo when debuginfo is not requested.] (rust-lang/cargo#13257) - [Inherit jobserver from env for all kinds of runners.] (rust-lang/cargo#12776) - [Deprecate rustc plugin support in cargo.] (rust-lang/cargo#13248) Rustdoc ----- - [Allows links in markdown headings.] (rust-lang/rust#117662) - [Search for tuples and unit by type with `()`.] (rust-lang/rust#118194) - [Clean up the source sidebar's hide button.] (rust-lang/rust#119066) - [Prevent JS injection from `localStorage`.] (rust-lang/rust#120250) Misc ---- - [Recommend version-sorting for all sorting in style guide.] (rust-lang/rust#115046) Internal Changes ---------------- These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools. - [Add more weirdness to `weird-exprs.rs`.] (rust-lang/rust#119028)
This is a redesign of the feature, with parts pulled from #119049 but with a button that looks more like a button and matches the one used on other sidebar pages.
Preview: