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: linkify "Structs", "Traits", etc., in sidebar #92957

Closed
jsha opened this issue Jan 16, 2022 · 7 comments · Fixed by #93673
Closed

rustdoc: linkify "Structs", "Traits", etc., in sidebar #92957

jsha opened this issue Jan 16, 2022 · 7 comments · Fixed by #93673
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@jsha
Copy link
Contributor

jsha commented Jan 16, 2022

In rustdoc sidebars, most headings are clickable links. For instance, "Required Methods" and "Implementors" in the sidebar of https://doc.rust-lang.org/nightly/std/string/trait.ToString.html.

However, the headings under "Other items in..." are not clickable. We should link those to the appropriate subheading on the module page. That allows the user to see a more verbose listing of items in the module, since each one has a description alongside it.

@jsha jsha added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. 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 16, 2022
@TmLev
Copy link
Contributor

TmLev commented Jan 17, 2022

So, for instance, sidebar heading Structs should lead here?

@chansuke
Copy link
Contributor

@rustbot claim

@jsha
Copy link
Contributor Author

jsha commented Jan 17, 2022

So, for instance, sidebar heading Structs should lead here?

Yes, that's correct.

@jsha
Copy link
Contributor Author

jsha commented Jan 21, 2022

By the way @chansuke be aware this will conflict with #92660. Resolving the conflict should be pretty easy though.

@chansuke
Copy link
Contributor

@jsha Thanks

@jsha
Copy link
Contributor Author

jsha commented Jan 31, 2022

@chansuke any progress on this? I'd like to get it landed before the beta cut, so we have a consistent UI where headings in the sidebar are clickable.

@chansuke
Copy link
Contributor

@jsha sorry, i couldn't make time last week.ok,i will unassign me, thanks.

@chansuke chansuke removed their assignment Jan 31, 2022
m-ou-se added a commit to m-ou-se/rust that referenced this issue Feb 7, 2022
…illaumeGomez

Linkify sidebar headings for sibling items

Also adjust CSS so this doesn't produce excess padding/margin.

Note: I tried and failed to write a test with browser-UI-test. First I tried to `assert-property: (".block.mod h3 a", {"href": "index.html#macros"})`. But the `href` that gets read out is the fully-quallified URL, starting with `file:///`. That URL will differ depending on what path the test is run from, so that doesn't work.

Next I tried clicking on the appropriate sidebar link, and verifying that the appropriate heading on the next page is highlighted with the right background color. However, that also didn't work: according to browser-UI-test, the targeted heading was plain white. However, running with no-headless, I could see that it actually was yellow. I suspect this is a bug in the older version of Chromium used with browser-UI-test's bundled puppeteer, since it doesn't reproduce on latest Chrome.

Fixes rust-lang#92957

Demo: https://rustdoc.crud.net/jsha/linkify-sidebar-headings/std/string/trait.ToString.html

r? `@GuillaumeGomez`
@bors bors closed this as completed in 0b6c7fb Feb 7, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 8, 2022
Fix hover effects in sidebar

The dark and ayu themes have a menu-like highlight on sidebar items. The light theme used to, but it was accidentally lost in the sidebar unification. The change brings back the hover effect in the light theme.

It also makes the hover effect apply consistently to all links in the sidebar, including headings.

It also simplifies the "In _path_" heading so it's one big link. The breadcrumbs are still readily available at the top of the page.

Note that a small number of headings are not linkified and so don't get the hover effect. That will be fixed with rust-lang#92957.

Demo: https://rustdoc.crud.net/jsha/sidebar-hover/std/string/trait.ToString.html

r? `@GuillaumeGomez`

Fixes rust-lang#93115
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) E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. 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.

3 participants