-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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] Make the buttons remain when code example is clicked #128339
Conversation
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
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;
}
} |
Just one issue with this media query: it doesn't work in headless mode. ^^' |
2f53a3e
to
99906dc
Compare
Can you test with this approach please? |
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? |
Done! |
@bors r+ rollup |
…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
…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
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`
…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!): ![Screenshot from 2024-07-30 15-16-31](https://github.com/user-attachments/assets/5e262e5b-f338-4085-94ca-e223033a43db) Can be tested [here](https://rustdoc.crud.net/imperio/run-button/foo/struct.Bar.html). r? `@notriddle`
…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!): ![Screenshot from 2024-07-30 15-16-31](https://github.com/user-attachments/assets/5e262e5b-f338-4085-94ca-e223033a43db) Can be tested [here](https://rustdoc.crud.net/imperio/run-button/foo/struct.Bar.html). r? `@notriddle`
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!): ![Screenshot from 2024-07-30 15-16-31](https://github.com/user-attachments/assets/5e262e5b-f338-4085-94ca-e223033a43db) Can be tested [here](https://rustdoc.crud.net/imperio/run-button/foo/struct.Bar.html). r? `@notriddle`
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
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.
r? @notriddle