Skip to content

rustdoc: run-button is scrolled together with code example #68337

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

Closed
jfrimmel opened this issue Jan 18, 2020 · 2 comments · Fixed by #68553
Closed

rustdoc: run-button is scrolled together with code example #68337

jfrimmel opened this issue Jan 18, 2020 · 2 comments · Fixed by #68553
Labels
C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@jfrimmel
Copy link
Contributor

Currently rustdoc emits HTML/CSS for the official Rust std documentation, that includes Run-buttons, as shown below (current nightly documentation of std::string::String):
image, if the content is not scrolled
This works fine (although sometimes the Run-button might be above code), as long as the content of the code block is not scrollable horizontally.
If, on the other hand, the code block is scrollable horizontally, e.g. because the code shown has really long lines or the browser window is small, the Run button will be scrolled, too:
image with non-scrolled content
image with scrolled content and Run-button
I think the button is supposed to be in the top right hand corner and should stay there, even if the content is scrolled horizontally. I didn't notice similar behavior vertically as there is no "long enough" code example (which is good 😄)

I think, that a little CSS and possibly a change in the generated HTML should do the trick.

@jonas-schievink jonas-schievink added C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jan 18, 2020
@JohnTitor
Copy link
Member

JohnTitor commented Jan 19, 2020

Currently, the button has position: absolute. When we change it to sticky and tweak the position and parent element, it should work fine, I think.
ref. https://developer.mozilla.org/en-US/docs/Web/CSS/position and https://caniuse.com/#search=sticky

@GuillaumeGomez
Copy link
Member

@JohnTitor It doesn't work apparently. And there is a simpler solution: just move the element into the parent which doesn't scroll. :)

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-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants