[rustdoc] Make the buttons remain when code example is clicked#128339
Merged
bors merged 2 commits intorust-lang:masterfrom Jul 30, 2024
Merged
[rustdoc] Make the buttons remain when code example is clicked#128339bors merged 2 commits intorust-lang:masterfrom
bors merged 2 commits intorust-lang:masterfrom
Conversation
Collaborator
|
Some changes occurred in HTML/CSS/JS. cc @GuillaumeGomez, @jsha |
This comment has been minimized.
This comment has been minimized.
2f53a3e to
e890807
Compare
e890807 to
2f53a3e
Compare
Contributor
|
This works swimmingly on Android, but on iPadOS it's kind of a mess. Screen.Recording.2024-07-29.at.09.30.16.movAccording to css-tricks.com, the magic spell is to use a hover media query: @media (hover: hover) {
.example-wrap:hover > .test-arrow, .example-wrap:hover > .button-holder {
visibility: visible;
}
} |
Member
Author
|
Just one issue with this media query: it doesn't work in headless mode. ^^' |
2f53a3e to
99906dc
Compare
Member
Author
|
Can you test with this approach please? |
Contributor
|
Seems to work fine. For the sake of anyone else who wants to try it, can you upload this new version to crud.net also? |
Member
Author
|
Done! |
Contributor
|
@bors r+ rollup |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jul 30, 2024
…iaskrgr Rollup of 4 pull requests Successful merges: - rust-lang#127574 (elaborate unknowable goals) - rust-lang#128141 (Set branch protection function attributes) - rust-lang#128315 (Fix vita build of std and forbid unsafe in unsafe in the os/vita module) - rust-lang#128339 ([rustdoc] Make the buttons remain when code example is clicked) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jul 30, 2024
…iaskrgr Rollup of 4 pull requests Successful merges: - rust-lang#127574 (elaborate unknowable goals) - rust-lang#128141 (Set branch protection function attributes) - rust-lang#128315 (Fix vita build of std and forbid unsafe in unsafe in the os/vita module) - rust-lang#128339 ([rustdoc] Make the buttons remain when code example is clicked) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jul 30, 2024
Rollup merge of rust-lang#128339 - GuillaumeGomez:click-code-example, r=notriddle [rustdoc] Make the buttons remain when code example is clicked Follow-up of rust-lang#125779. One current issue we have with "run" button and the newly added copy code button is that if you're on mobile devices, you can't use them. I took a look at how `mdbook` is handling it and when you click on a code example, they show the buttons. I think it's a really good idea as if you want to copy the code on your mobile device, you will click on it, showing the buttons. Feature can be tested [here](https://rustdoc.crud.net/imperio/click-code-example/foo/struct.Bar.html). r? `@notriddle`
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this pull request
Aug 12, 2024
…tdoc Unify run button display with "copy code" button and with mdbook buttons Follow-up of rust-lang#128339. It looks like this (coherency++, yeay!):  Can be tested [here](https://rustdoc.crud.net/imperio/run-button/foo/struct.Bar.html). r? `@notriddle`
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this pull request
Aug 12, 2024
…tdoc Unify run button display with "copy code" button and with mdbook buttons Follow-up of rust-lang#128339. It looks like this (coherency++, yeay!):  Can be tested [here](https://rustdoc.crud.net/imperio/run-button/foo/struct.Bar.html). r? `@notriddle`
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Aug 12, 2024
Rollup merge of rust-lang#128394 - GuillaumeGomez:run-button, r=t-rustdoc Unify run button display with "copy code" button and with mdbook buttons Follow-up of rust-lang#128339. It looks like this (coherency++, yeay!):  Can be tested [here](https://rustdoc.crud.net/imperio/run-button/foo/struct.Bar.html). r? `@notriddle`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up of #125779.
One current issue we have with "run" button and the newly added copy code button is that if you're on mobile devices, you can't use them. I took a look at how
mdbookis handling it and when you click on a code example, they show the buttons. I think it's a really good idea as if you want to copy the code on your mobile device, you will click on it, showing the buttons.Feature can be tested here.
r? @notriddle