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

Enable wrapping words by default #92801

Merged
merged 1 commit into from
Jan 18, 2022
Merged

Enable wrapping words by default #92801

merged 1 commit into from
Jan 18, 2022

Conversation

jsha
Copy link
Contributor

@jsha jsha commented Jan 12, 2022

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 #92771

Some related discussion and a related issue: #92421.

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

r? @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 Jan 12, 2022
@rust-highfive
Copy link
Collaborator

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez,@Folyd

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 12, 2022
@jsha jsha force-pushed the overflow-wrap branch 2 times, most recently from d2f03f9 to c73a371 Compare January 12, 2022 20:55
@jsha
Copy link
Contributor Author

jsha commented Jan 13, 2022

You can see an example of how table scrolling looks by visiting the demo at https://rustdoc.crud.net/jsha/overflow-wrap/std/collections/index.html#sequences and setting mobile (responsive) mode in Dev Tools.

@GuillaumeGomez
Copy link
Member

Found a funny bug 😆

Screenshot from 2022-01-14 11-01-50

Not sure if it's coming from this PR but the version and source are stuck to each other:

Screenshot from 2022-01-14 11-03-47

@jsha
Copy link
Contributor Author

jsha commented Jan 14, 2022

version and source are stuck to each other:

Looks like it's not limited to this PR. That's interesting! will fix. https://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html#method.step_by

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.
@jsha
Copy link
Contributor Author

jsha commented Jan 15, 2022

Fixed the bug with the theme picker.

@GuillaumeGomez
Copy link
Member

Can you update the online docs please? (if you already did, the bug is still there ^^')

@jsha
Copy link
Contributor Author

jsha commented Jan 15, 2022

Have you done a hard refresh? I've updated the demo and the bug no longer reproduces on Chrome or Firefox.

@GuillaumeGomez
Copy link
Member

Ah indeed. Sorry I should have thought about it... Looks all good now, thanks!

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Jan 17, 2022

📌 Commit 4d5a6c9 has been approved by GuillaumeGomez

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 17, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 17, 2022
…askrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#90498 (Clarifications in the target tier policy)
 - rust-lang#92164 (Implement `#[rustc_must_implement_one_of]` attribute)
 - rust-lang#92729 (rustc_codegen_llvm: Remove (almost) unused span parameter from many functions in metadata.rs)
 - rust-lang#92752 (Correct minor typos in some long error code explanations)
 - rust-lang#92801 (Enable wrapping words by default)
 - rust-lang#92825 (Rename environment variable for overriding rustc version)
 - rust-lang#92877 (Remove LLVMRustMarkAllFunctionsNounwind)
 - rust-lang#92936 (rustdoc: Remove `collect` in `html::markdown::parse`)
 - rust-lang#92956 (Add `log2` and `log10` to `NonZeroU*`)
 - rust-lang#92960 (Use `carrying_{mul|add}` in `num::bignum`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 51aa20d into rust-lang:master Jan 18, 2022
@rustbot rustbot added this to the 1.60.0 milestone Jan 18, 2022
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) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Horizontal overscroll on iOS
5 participants