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 header collapse toggles are heinously misaligned #45158

Closed
erincandescent opened this issue Oct 9, 2017 · 8 comments
Closed

RustDoc header collapse toggles are heinously misaligned #45158

erincandescent opened this issue Oct 9, 2017 · 8 comments
Labels
C-bug Category: This is a bug. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@erincandescent
Copy link

@QuietMisdreavus posted a screenshot of some RustDoc updates. In it, a header collapse button is shown. It is heinously out of alignment with the header text. I will never be able to unsee this and this bug will follow me to the end of my days.

Please can some CSS wizard fix the alignment of these widgets so that I will once again be able to use Rust documentation without involuntarily twitching each time a collapse toggle pops up.

@erincandescent
Copy link
Author

Actually I see this is really a "description collapse" toggle and it mirrors one top-right by the source button. For further amusement, these toggles can get out of sync.

Maybe the annoying misaligned one on the left should be removed?

@QuietMisdreavus
Copy link
Member

Nah, the one on the left only folds the crate description - it mirrors the top-level description of things like structs or traits, which stick their top-level docs there. The one on the top-right is to toggle everything on the page, which is more useful when there's more than one docblock to toggle.

cc @GuillaumeGomez - this should be a fairly small CSS fix, right?

@QuietMisdreavus QuietMisdreavus added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. C-bug Category: This is a bug. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. labels Oct 9, 2017
@chris-morgan
Copy link
Member

The difficulty is that the content is just generic content; it could start with an h1, an h2, a p, &c. Thanks to margin-top and line-height, positioning the toggle ideally requires knowledge of the first element in the content, and you’d need to customise it for each case.

With the way it’s all structured, there’s no way to fix this with CSS alone. The toggle is in a previous sibling of the content element, so you can’t target it with CSS depending on what the content starts with. The toggle would need a class added to it to signify what the content starts with, either in the rustdoc code or through JavaScript.

@GuillaumeGomez
Copy link
Member

I'm not sure if this is such a good idea...

@bluss
Copy link
Member

bluss commented Oct 10, 2017

The [-] toggle is at least aligned fine when the doc comment does not start with a header, which is also a common thing like in https://doc.rust-lang.org/nightly/std/thread/struct.Thread.html

A couple of things happen if the doc comment starts with a header. This misalignment, and if you hover over the header, the collapse icon and the header's § icon overlap too.

@GuillaumeGomez
Copy link
Member

@bluss: I don't see what overlap issue you're talking about...

@bluss
Copy link
Member

bluss commented Oct 13, 2017

@GuillaumeGomez The [-] icon and the § symbol overlap on Firefox and Chromium (Linux), it should be visible in these screenshots:

Overlap illustration

From URL: https://doc.rust-lang.org/nightly/std/

@GuillaumeGomez
Copy link
Member

Oh I see. I'll write a fix when I get time.

kennytm added a commit to kennytm/rust that referenced this issue Nov 1, 2017
…tMisdreavus

Fix title heading overlap in rust doc

Fixes rust-lang#45158.

To be noted that this margin only appears when a title is the first element.

<img width="1440" alt="screen shot 2017-10-22 at 16 08 44" src="https://user-images.githubusercontent.com/3050060/31862746-6411070e-b743-11e7-9a75-4159e1f7f1d6.png">

r? @rust-lang/docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants