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: tweak line spacing and paragraph spacing for accessibility #93694

Merged
merged 1 commit into from
Feb 9, 2022

Conversation

jsha
Copy link
Contributor

@jsha jsha commented Feb 6, 2022

The W3C Web Content Accessibility Guidelines specify a minimum line spacing of 1.5 and a minimum paragraph spacing of 1.5 times the line spacing. Our current line spacing (implemented by line-height) is 1.4, so it's a small bump to go up to 1.5. Similarly, we have a paragraph spacing of 0.6em. Bump that to 0.75em (which is 1.5 times the 0.5em distance between lines).

Also, fix all the font sizes so instead of being round-ish numbers in rem (like 1.1rem, 1.2rem), they are round numbers in pixels: 16px, 18px, 20px, 22px, 24px. Ensure each font size is at least 2 pixels different than the nearest other font size, so distinctions can be clearly seen. Overall the font-sizes are mostly staying the same, being rounded up or down as appropriate. This will make reasoning about consistent layout sizes much easier.

Remove a few unused styles.

Simplify the display of the mobile-topbar location, by setting its margins to auto rather than trying to size it exactly to the topbar.

Part of #59845.

Demo: https://rustdoc.crud.net/jsha/font-sizes-spacing/std/string/struct.String.html

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 Feb 6, 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 Feb 6, 2022
@bors
Copy link
Contributor

bors commented Feb 6, 2022

☔ The latest upstream changes (presumably #93689) made this pull request unmergeable. Please resolve the merge conflicts.

@GuillaumeGomez
Copy link
Member

This updated the position of the doc toggle a bit, making it not aligned with the function anymore:

Screenshot from 2022-02-07 11-06-09

@bors
Copy link
Contributor

bors commented Feb 7, 2022

☔ The latest upstream changes (presumably #93738) made this pull request unmergeable. Please resolve the merge conflicts.

@jsha jsha force-pushed the font-sizes-spacing branch 2 times, most recently from b7c2d29 to 9ae788d Compare February 8, 2022 05:16
@GuillaumeGomez
Copy link
Member

Thanks!

@bors: r+
@bors: rollup

@bors
Copy link
Contributor

bors commented Feb 8, 2022

📌 Commit 9ae788d0c4539f83b9502b5bbbf724d5e8a4b216 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 Feb 8, 2022
@bors
Copy link
Contributor

bors commented Feb 8, 2022

☔ The latest upstream changes (presumably #93762) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 8, 2022
The W3C Web Content Accessibility Guidelines specify a minimum line
spacing of 1.5 and a minimum paragraph spacing of 1.5 times the line
spacing. Our current line spacing (implemented by line-height) is 1.4,
so it's a small bump to go up to 1.5. Similarly, we have a paragraph
spacing of 0.6em. Bump that to 0.75em (which is 1.5 times the 0.5em
distance between lines).

Also, fix all the font sizes so instead of being round-ish numbers in
rem (like 1.1rem, 1.2rem), they are round numbers in pixels. Ensure each
font size is at least 2 pixels different than the nearest other font
size, so distinctions can be clearly seen. Overall the font-sizes are
mostly staying the same, being rounded up or down as appropriate.

Remove a few unused styles.

Simplify the display of the mobile-topbar location, by setting its
margins to auto rather than trying to size it exactly to the topbar.
@jsha
Copy link
Contributor Author

jsha commented Feb 8, 2022

@bors r=GuillaumeGomez

@bors
Copy link
Contributor

bors commented Feb 8, 2022

📌 Commit dd5ff42 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 8, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 9, 2022
Rollup of 7 pull requests

Successful merges:

 - rust-lang#93445 (Add From<u8> for ExitCode)
 - rust-lang#93694 (rustdoc: tweak line spacing and paragraph spacing for accessibility)
 - rust-lang#93735 (Stabilize int_abs_diff in 1.60.0.)
 - rust-lang#93746 (Remove defaultness from ImplItem.)
 - rust-lang#93748 (rustc_query_impl: reduce visibility of some modules/fn's)
 - rust-lang#93751 (Drop tracking: track borrows of projections)
 - rust-lang#93781 (update `ty::TyKind` documentation)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit a508448 into rust-lang:master Feb 9, 2022
@rustbot rustbot added this to the 1.60.0 milestone Feb 9, 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.

5 participants