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

Unify run button display with "copy code" button and with mdbook buttons #128394

Merged
merged 4 commits into from
Aug 12, 2024

Conversation

GuillaumeGomez
Copy link
Member

Follow-up of #128339.

It looks like this (coherency++, yeay!):

Screenshot from 2024-07-30 15-16-31

Can be tested here.

r? @notriddle

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jul 30, 2024
@rustbot
Copy link
Collaborator

rustbot commented Jul 30, 2024

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez, @jsha

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez
Copy link
Member Author

This time it seems like I updated all the tests correctly. :D

@notriddle
Copy link
Contributor

Okay, one thing I noticed while poking around the demo that I wish I'd noticed last time: clicking the Copy button does the same thing as clicking the text box itself, so it toggles the visibility lock. It probably shouldn't do that.

If you're using a desktop mouse, you hover over the text box, the buttons appear, and you click the Copy button. The buttons are now in "sticky" mode and don't go away, even when the mouse leaves the box.

If you're using a touchscreen, you tap the box and the buttons appear, then you click the Copy button and it instantly vanishes, so you never see the confirmation checkmark.

@GuillaumeGomez
Copy link
Member Author

Oh that's a great point! Fixing that and adding a GUI test for it.

@GuillaumeGomez
Copy link
Member Author

Done and also updated online demo.

@notriddle
Copy link
Contributor

@rfcbot fcp merge

@rfcbot

This comment was marked as outdated.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Jul 30, 2024
@notriddle notriddle added T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. and removed T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jul 30, 2024
@notriddle

This comment was marked as outdated.

@rfcbot

This comment was marked as outdated.

@rfcbot rfcbot removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Jul 30, 2024
@notriddle
Copy link
Contributor

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented Jul 30, 2024

Team member @notriddle has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Jul 30, 2024
@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@camelid camelid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rfcbot reviewed

I'd like us to use the mdBook copy icon too, but this is a very good start in any case. I left comments for changes I'd like on the details.

color: var(--test-arrow-hover-color);
background-color: var(--test-arrow-hover-background-color);
a.test-arrow::before {
content: url('data:image/svg+xml,<svg viewBox="0 0 20 20" width="18" height="20" \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels a little large relative to the copy button; what do you think about this? It looks more proportional to my eye. Other code might need to be updated to fix the baseline position too.

Suggested change
content: url('data:image/svg+xml,<svg viewBox="0 0 20 20" width="18" height="20" \
content: url('data:image/svg+xml,<svg viewBox="0 0 20 20" width="15" height="15" \

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also would it be better to move this to a CSS variable like the clipboard icon and others?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's only used in one place, so not sure it would be a good idea. Since you suggested to change the image for the copy button, I'll resize when I'll update it.

Copy link
Contributor

@notriddle notriddle Jul 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not sure changing the copy icon is a good idea. mdbook might be using a different one, but crates.io and docs.rs use this one.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I'll send a PR to mdBook. ;)

Copy link
Member

@camelid camelid Jul 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not sure changing the copy icon is a good idea. mdbook might be using a different one, but crates.io and docs.rs use this one.

Good point, I didn't notice that. I do think mdBook's version (which is from Font Awesome) is more common in UIs generally than the rustdoc/crates.io/docs.rs one, but we should definitely be consistent, and it sounds like mdBook is the one out of line here.

@camelid
Copy link
Member

camelid commented Jul 31, 2024

Oh, I should clarify that my approval was meant for FCP purposes. I didn't review the code in detail since I think notriddle already did that :)

@rfcbot rfcbot added the final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. label Jul 31, 2024
@rfcbot
Copy link

rfcbot commented Jul 31, 2024

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot removed the proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. label Jul 31, 2024
@GuillaumeGomez
Copy link
Member Author

I opened the PR to unify mdBook "copy code" button with rustdoc, docs.rs and crates.io in rust-lang/mdBook#2421.

@bors
Copy link
Contributor

bors commented Aug 4, 2024

☔ The latest upstream changes (presumably #128614) made this pull request unmergeable. Please resolve the merge conflicts.

@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Aug 11, 2024
@rfcbot
Copy link

rfcbot commented Aug 11, 2024

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

@GuillaumeGomez
Copy link
Member Author

@bors r=t-rustdoc

@bors
Copy link
Contributor

bors commented Aug 12, 2024

📌 Commit 59cb159 has been approved by t-rustdoc

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 Aug 12, 2024
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!):

![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`
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 12, 2024
…llaumeGomez

Rollup of 7 pull requests

Successful merges:

 - rust-lang#126245 (Greatly speed up doctests by compiling compatible doctests in one file)
 - rust-lang#128394 (Unify run button display with "copy code" button and with mdbook buttons)
 - rust-lang#128878 (Slightly refactor `Flags` in bootstrap)
 - rust-lang#128886 (Get rid of some `#[allow(rustc::untranslatable_diagnostic)]`)
 - rust-lang#128929 (Fix codegen-units tests that were disabled 8 years ago)
 - rust-lang#128967 (std::fs::get_path freebsd update.)
 - rust-lang#128978 (Use `assert_matches` around the compiler more)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 12, 2024
…llaumeGomez

Rollup of 10 pull requests

Successful merges:

 - rust-lang#128149 (nontemporal_store: make sure that the intrinsic is truly just a hint)
 - rust-lang#128394 (Unify run button display with "copy code" button and with mdbook buttons)
 - rust-lang#128537 (const vector passed through to codegen)
 - rust-lang#128632 (std: do not overwrite style in `get_backtrace_style`)
 - rust-lang#128878 (Slightly refactor `Flags` in bootstrap)
 - rust-lang#128886 (Get rid of some `#[allow(rustc::untranslatable_diagnostic)]`)
 - rust-lang#128929 (Fix codegen-units tests that were disabled 8 years ago)
 - rust-lang#128937 (Fix warnings in rmake tests on `x86_64-unknown-linux-gnu`)
 - rust-lang#128978 (Use `assert_matches` around the compiler more)
 - rust-lang#128994 (Fix bug in `Parser::look_ahead`.)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit c6e3385 into rust-lang:master Aug 12, 2024
6 checks passed
@rustbot rustbot added this to the 1.82.0 milestone Aug 12, 2024
@GuillaumeGomez GuillaumeGomez deleted the run-button branch August 12, 2024 18:58
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!):

![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`
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants