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

Overflow in sidebar heading "See all _ items" #92421

Closed
jsha opened this issue Dec 29, 2021 · 3 comments
Closed

Overflow in sidebar heading "See all _ items" #92421

jsha opened this issue Dec 29, 2021 · 3 comments
Labels
A-rustdoc-ui Area: rustdoc UI (generated HTML) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@jsha
Copy link
Contributor

jsha commented Dec 29, 2021

When a crate name is long, the "See all <crate name> items" heading in the sidebar overflows its box.

E.g.: https://docs.rs/trillium-caching-headers/0.1.0/trillium_caching_headers/index.html

image

Note that Crate trillium_caching_headers above it does not overflow, because it has word-wrap: break-word. Perhaps we should consider applying that to everything as a default (since we often have this type of overflow problem), and override that default in specific places, like code examples, where we'd rather have a horizontal scroll.

Another recent example of overflowing a box was #89972 (and a fix in #90018).

cc @GuillaumeGomez

@jsha jsha added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-rustdoc-ui Area: rustdoc UI (generated HTML) labels Dec 29, 2021
@jsha
Copy link
Contributor Author

jsha commented Dec 30, 2021

Alternately we could ellipsize it like we do for some other sidebar items:

image

We should pick one strategy or the other for the sidebar, or come up with some reasoning why we should do it differently for headings vs links.

@jsha
Copy link
Contributor Author

jsha commented Dec 30, 2021

Actually, the ellipsization is broken, because it will ellipsize and wrap in some situations:

image

For instance FromIterator<Box<str, Global>> gets shown as FromIterator<Bo... and Global>> on the next line.

The example is from the sidebar for String, but with a larger font size than the default.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 17, 2022
Enable wrapping words by default

Faced with a very long word, browsers will let it overflow its
box horizontally rather than break it in the middle. We essentially
never want that behavior. We would rather break the word and keep it
inside its horizontal limits. So we apply a default overflow-wrap:
break-word/anywhere to the document as a while.

In some contexts we would rather add a horizontal scrollbar (code
blocks), or elide the excess text with an ellipsis (sidebar). Those
still work as expected.

Fixes rust-lang#92771

[Some related discussion](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/wrap.20.2F.20overflow.20.2F.20scroll) and a related issue: rust-lang#92421.

Demo: https://rustdoc.crud.net/jsha/overflow-wrap/std/iter/trait.Iterator.html#method.try_find

r? ``@GuillaumeGomez``
@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Feb 15, 2022

It has been fixed differently in the end:

Screenshot from 2022-02-15 11-50-48

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) 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

2 participants