Skip to content

rustdoc: simplify the codeblock tooltip #101600

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Sep 9, 2022
Merged

Conversation

notriddle
Copy link
Contributor

@notriddle notriddle commented Sep 9, 2022

This PR moves the tooltip into example-wrap, simplifying several overly-complex aspects of how these tooltips work:

  • The mousover javascript can be removed, because hovering example-wrap can style the tooltip inside.
  • The sibling selecor can be removed, because hovering the tooltip also hovers the wrapper, which can hover the codeblock itself.
  • The relative positioning of the <li> tag, which was added in e861efd to fix the positioning of the code tooltip, can now be removed, because example-wrap itself already has relative positioning.

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

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 Sep 9, 2022
@rust-log-analyzer

This comment has been minimized.

@notriddle notriddle force-pushed the notriddle/li branch 2 times, most recently from 24e1a38 to d734633 Compare September 9, 2022 03:12
@rust-log-analyzer

This comment has been minimized.

@notriddle
Copy link
Contributor Author

r? @GuillaumeGomez

@rust-highfive rust-highfive assigned GuillaumeGomez and unassigned jsha Sep 9, 2022
@notriddle notriddle marked this pull request as ready for review September 9, 2022 12:50
@rustbot
Copy link
Collaborator

rustbot commented Sep 9, 2022

A change occurred in the Ayu theme.

cc @Cldfire

Some changes occurred in HTML/CSS themes.

cc @GuillaumeGomez

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez, @Folyd, @jsha

@GuillaumeGomez
Copy link
Member

Please rebase. Also I was about to work on simplifying the tooltips but differently. I think this PR and mine will be complementary. Interesting how things turn up.

This commit moves the tooltip into example-wrap, simplifying allowing several
overly-complex things to be fixed:

* The mousover javascript can be removed, because hovering example-wrap can
  style the tooltip inside.
* The sibling selecor can be removed, because hovering the tooltip also
  hovers the wrapper, which can hover the codeblock itself.
* The relative positioning of the `<li>` tag, which was added in
  e861efd to fix the positioning of the code
  tooltip, can now be removed, because example-wrap itself already has
  relative positioning.
@notriddle
Copy link
Contributor Author

@GuillaumeGomez okay, it’s rebased

@GuillaumeGomez
Copy link
Member

Looks good to me, thanks! r=me once CI pass

@GuillaumeGomez
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Sep 9, 2022

📌 Commit cbcb74e has been approved by GuillaumeGomez

It is now in the queue for this repository.

@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 Sep 9, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 9, 2022
…llaumeGomez

Rollup of 5 pull requests

Successful merges:

 - rust-lang#101475 (Use futex-based locks and thread parker on Hermit)
 - rust-lang#101492 (Suggest adding array lengths to references to arrays if possible)
 - rust-lang#101495 (Compile spin_loop_hint as pause on x86 even without sse2 enabled)
 - rust-lang#101529 (Fix the example code and doctest for Formatter::sign_plus)
 - rust-lang#101600 (rustdoc: simplify the codeblock tooltip)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 2e258ce into rust-lang:master Sep 9, 2022
@rustbot rustbot added this to the 1.65.0 milestone Sep 9, 2022
@notriddle notriddle deleted the notriddle/li branch September 9, 2022 23:07
compiler-errors added a commit to compiler-errors/rust that referenced this pull request Sep 10, 2022
…r=notriddle

Simplify codeblock and their associated tooltip

It is based on rust-lang#101600 so it needs to wait for this one to be merged first.

This PR does two things:

 * Remove CSS class duplication by setting CSS classes such as `compile_fail` directly on the `div` wrapping both the codeblock and the tooltip.
 * Simplify DOM: no need to wrap the tooltip into a `<div>`, it can work just as well without it.

You can test it [here](https://rustdoc.crud.net/imperio/codeblock-tooltip/std/string/struct.String.html#deref).

r? `@notriddle`
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 10, 2022
…notriddle

Simplify codeblock and their associated tooltip

It is based on rust-lang#101600 so it needs to wait for this one to be merged first.

This PR does two things:

 * Remove CSS class duplication by setting CSS classes such as `compile_fail` directly on the `div` wrapping both the codeblock and the tooltip.
 * Simplify DOM: no need to wrap the tooltip into a `<div>`, it can work just as well without it.

You can test it [here](https://rustdoc.crud.net/imperio/codeblock-tooltip/std/string/struct.String.html#deref).

r? `@notriddle`
# for free to join this conversation on GitHub. Already have an account? # 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.

7 participants