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: Declaration truncated on small mobile screens #84354

Closed
jsha opened this issue Apr 20, 2021 · 6 comments · Fixed by #84376
Closed

rustdoc: Declaration truncated on small mobile screens #84354

jsha opened this issue Apr 20, 2021 · 6 comments · Fixed by #84376
Assignees
Labels
A-rustdoc-ui Area: rustdoc UI (generated HTML) C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@jsha
Copy link
Contributor

jsha commented Apr 20, 2021

To reproduce, open Chrome devtools, turn on the device toolbar (Ctrl Shift M). I believe this defaults to "Moto G4" (360x640). If not, select Moto G4. Then visit, e.g. https://doc.rust-lang.org/nightly/std/io/trait.Read.html.



The stable version of the same page looks fine:



@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 Apr 20, 2021
@torhovland
Copy link
Contributor

@rustbot claim

@torhovland
Copy link
Contributor

Using flex on h1, now it's like this on narrow screens:

image

@GuillaumeGomez GuillaumeGomez added the A-rustdoc-ui Area: rustdoc UI (generated HTML) label Apr 22, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Apr 22, 2021
…Gomez

Uses flex to fix formatting of h1 at any width

Fixes rust-lang#84354.
@bors bors closed this as completed in 7b6fd61 Apr 22, 2021
@jsha
Copy link
Contributor Author

jsha commented Apr 23, 2021

#84376 is a definite improvement, thanks @torhovland! I'm curious: why fix this by wrapping the trait name and the out-of-band items (version, -, src)? It seems like the problem is not that out-of-band is pushed onto the next line, but the out-of-band interferes with the sizing of the declaration.

Generally it seems better for the trait name to use as much of a line as it can, even at the cost of pushing the out-of-band items to the next line.

@jsha jsha reopened this Apr 23, 2021
@torhovland
Copy link
Contributor

I'm curious: why fix this by wrapping the trait name and the out-of-band items (version, -, src)? It seems like the problem is not that out-of-band is pushed onto the next line, but the out-of-band interferes with the sizing of the declaration.

Hmm, I didn't wrap anything or otherwise change the HTML structure. I've just introduced flex here so that (particularly with the addition of #84451) it works the same way as the method declarations further down on the page.

You can of course argue that it might be better if the out-of-band items were pushed to the next line, but I feel that justifies its own issue.

@torhovland
Copy link
Contributor

Having said that, it looks easy enough to do. Check out the example at https://jsfiddle.net/uyoLdx6m/2/

I can update #84451 with that if you like.

@jsha
Copy link
Contributor Author

jsha commented Apr 23, 2021

I didn't wrap anything or otherwise change the HTML structure.

Ah, I meant "adding flex so the trait name can line-wrap."

I also hadn't realized that we were already using flex on the method declarations. I agree: if we want to change that it should be its own issue, and in the meantime, good to be consistent and use flex here.

@jsha jsha closed this as completed Apr 23, 2021
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Apr 29, 2021
Use flex more consistently

Builds on rust-lang#84376, related to rust-lang#84354.

- Fully replaces `float: right` with `flex` on `.content .out-of-band`.
- Uses `flex` more consistently with existing usage (on `h3`, `h4`, etc.).

Tested on various widths to make sure the pages behave as before.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Apr 29, 2021
Use flex more consistently

Builds on rust-lang#84376, related to rust-lang#84354.

- Fully replaces `float: right` with `flex` on `.content .out-of-band`.
- Uses `flex` more consistently with existing usage (on `h3`, `h4`, etc.).

Tested on various widths to make sure the pages behave as before.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Apr 29, 2021
Use flex more consistently

Builds on rust-lang#84376, related to rust-lang#84354.

- Fully replaces `float: right` with `flex` on `.content .out-of-band`.
- Uses `flex` more consistently with existing usage (on `h3`, `h4`, etc.).

Tested on various widths to make sure the pages behave as before.
jackh726 added a commit to jackh726/rust that referenced this issue Apr 29, 2021
Use flex more consistently

Builds on rust-lang#84376, related to rust-lang#84354.

- Fully replaces `float: right` with `flex` on `.content .out-of-band`.
- Uses `flex` more consistently with existing usage (on `h3`, `h4`, etc.).

Tested on various widths to make sure the pages behave as before.
jackh726 added a commit to jackh726/rust that referenced this issue Apr 29, 2021
Use flex more consistently

Builds on rust-lang#84376, related to rust-lang#84354.

- Fully replaces `float: right` with `flex` on `.content .out-of-band`.
- Uses `flex` more consistently with existing usage (on `h3`, `h4`, etc.).

Tested on various widths to make sure the pages behave as before.
jackh726 added a commit to jackh726/rust that referenced this issue Apr 29, 2021
Use flex more consistently

Builds on rust-lang#84376, related to rust-lang#84354.

- Fully replaces `float: right` with `flex` on `.content .out-of-band`.
- Uses `flex` more consistently with existing usage (on `h3`, `h4`, etc.).

Tested on various widths to make sure the pages behave as before.
jackh726 added a commit to jackh726/rust that referenced this issue Apr 29, 2021
Use flex more consistently

Builds on rust-lang#84376, related to rust-lang#84354.

- Fully replaces `float: right` with `flex` on `.content .out-of-band`.
- Uses `flex` more consistently with existing usage (on `h3`, `h4`, etc.).

Tested on various widths to make sure the pages behave as before.
jackh726 added a commit to jackh726/rust that referenced this issue Apr 29, 2021
Use flex more consistently

Builds on rust-lang#84376, related to rust-lang#84354.

- Fully replaces `float: right` with `flex` on `.content .out-of-band`.
- Uses `flex` more consistently with existing usage (on `h3`, `h4`, etc.).

Tested on various widths to make sure the pages behave as before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-ui Area: rustdoc UI (generated HTML) 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