Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

rustdoc: copy code button obscures scraped example expand button #129763

Closed

Description

@willcrichton

Rustdoc's copy code button introduced in 9946a68 conflicts with the UI for interacting with scraped code examples. I noticed this in the wild in Bevy's documentation: https://docs.rs/bevy/0.14.1/bevy/app/struct.App.html#scraped-examples-1

In the upper right corner is a button for expanding a snipper:

Screenshot 2024-08-29 at 2 46 10 PM

But hovering over the snippet shows the copy code button, obscuring the expand button:

Screenshot 2024-08-29 at 2 46 24 PM

cc @GuillaumeGomez

Activity

  1. added
    C-bug
    on Aug 29, 2024
  2. added
    needs-triage
    on Aug 29, 2024
  3. added
    A-rustdoc-scrape-examples
    T-rustdoc
    requires-nightly
    and removed
    needs-triage
    on Aug 29, 2024
  4. GuillaumeGomez commented on Aug 30, 2024

    @GuillaumeGomez
    Member

    Arf indeed. I think code unification will be needed for this feature with the other code blocks to prevent such regressions in the future. Gonna send a fix.

  5. GuillaumeGomez commented on Aug 30, 2024

    @GuillaumeGomez
    Member

    I decided to integrate the buttons with the existing code examples. For now it looks like this:

    image

  6. willcrichton commented on Aug 30, 2024

    @willcrichton
    ContributorAuthor

    That looks great! Do the buttons have the same behavior where they only appear when you hover over the snippet?

  7. GuillaumeGomez commented on Aug 30, 2024

    @GuillaumeGomez
    Member

    Yes! I'm also planning to only generate them if they don't already exist on hover like the copy button (it is only created after you first hovered the code example), it'll reduce the HTML size quite a lot. I also simplified the HTML a bit (again, smaller). I almost didn't change anything in the scraped example JS code, which is quite nice. I expected more changes to be needed. Well done!

  8. added a commit that references this issue on Sep 3, 2024
    eaf2ac2
  9. added a commit that references this issue on Sep 4, 2024
    784cbd7
  10. added 3 commits that reference this issue on Sep 5, 2024
    a6fe092
    3f99c12
    9be97ae
  11. added a commit that references this issue on Sep 5, 2024
    8f4c69a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-scrape-examplesC-bugT-rustdocrequires-nightly

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions