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: clean up primitive.slice.html links #97668

Merged
merged 2 commits into from
Jun 3, 2022

Conversation

notriddle
Copy link
Contributor

@notriddle notriddle commented Jun 2, 2022

Before: Box<[T]>

After: Box<[T]>

@rustbot rustbot added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jun 2, 2022
@rust-highfive
Copy link
Collaborator

r? @jsha

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 2, 2022
@jsha
Copy link
Contributor

jsha commented Jun 3, 2022

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jun 3, 2022

📌 Commit dadf3bd has been approved by jsha

@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 Jun 3, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 3, 2022
Rollup of 5 pull requests

Successful merges:

 - rust-lang#97366 (Stabilize `{slice,array}::from_ref`)
 - rust-lang#97653 (add cast kind of from_exposed_addr (int-to-ptr casts))
 - rust-lang#97663 (take back half-baked noaliasing check in Assignment)
 - rust-lang#97664 (On E0204 suggest missing type param bounds)
 - rust-lang#97668 (rustdoc: clean up primitive.slice.html links)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit d6f35b3 into rust-lang:master Jun 3, 2022
@rustbot rustbot added this to the 1.63.0 milestone Jun 3, 2022
@notriddle notriddle deleted the notriddle/slice-link branch June 3, 2022 13:17
notriddle added a commit to notriddle/rust that referenced this pull request Jun 13, 2022
Since rust-lang#97668 was merged, the slice::get function now looks like this:

![image](https://user-images.githubusercontent.com/1593513/173430685-1dd2b275-2439-4392-b7d4-96bcb355a377.png)

That whole thing, `[T]`, is a single link to `primitive.slice.html`. This
definitely fixes it for this case, but it's not obvious what we should do for
slices of concrete types:

![image](https://user-images.githubusercontent.com/1593513/173430968-7eed1aec-b688-4f84-a492-9210aff0037a.png)

There are actually three links in that `[u8]`: the opening brace `[` is a
link to `primitive.slice.html`, the `u8` is a link to `primitive.u8.html`,
and the final `]` is a link to `primitive.slice.html`. This is a serious
[usability bug](https://usability.yale.edu/web-accessibility/articles/links):
the square braces are much too small for anyone who doesn't have perfect
motor control using mouse or touch, provide an excessive number of tab stops
for anyone using keyboard, and no visual indication whatsoever that they're
separate links.

Now that slices of generic types are linked, it seems reasonable to err on
the side of less clutter and stop linking concrete slices to the slice page.
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jun 14, 2022
…, r=jsha

rustdoc:  remove link on slice brackets

This is rust-lang#91778, take two.

Fixes rust-lang#91173

The reason I'm reevaluating this change is rust-lang#97668, which makes fully-generic slices link to the slice docs page. This fixes some downsides in the original PR, where `Box<[T]>`, for example, was not linked to the primitive.slice.html page. In this PR, the `[T]` inside is still a link.

The other major reason for wanting to reevaluate this is the changed color scheme. When this feature was first introduced in rustdoc, primitives were a different color from structs and enums. This way, eagle-eyed users could figure out that the square brackets were separate links from the structs inside. Now, all types have the same color, so a significant fraction of users won't even know the links are there unless they pay close attention to the status bar or use an accessibility tool that lists all links on the page.
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jun 14, 2022
…, r=jsha

rustdoc:  remove link on slice brackets

This is rust-lang#91778, take two.

Fixes rust-lang#91173

The reason I'm reevaluating this change is rust-lang#97668, which makes fully-generic slices link to the slice docs page. This fixes some downsides in the original PR, where `Box<[T]>`, for example, was not linked to the primitive.slice.html page. In this PR, the `[T]` inside is still a link.

The other major reason for wanting to reevaluate this is the changed color scheme. When this feature was first introduced in rustdoc, primitives were a different color from structs and enums. This way, eagle-eyed users could figure out that the square brackets were separate links from the structs inside. Now, all types have the same color, so a significant fraction of users won't even know the links are there unless they pay close attention to the status bar or use an accessibility tool that lists all links on the page.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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