Skip to content

Less obtrusive copy to clipboards on bs4_book #1040

@keithmcnulty

Description

@keithmcnulty

Might be a nicer UX for the copy to clipboard buttons to only appear on sourceCode blocks and also for them to only appear on mouseover. I achieved this with simple custom CSS, but may be worth considering as default?

pre .copy button {
  visibility: hidden;
}

div.sourceCode:hover > pre .copy button {
  visibility: visible;
}

Also, would be nicer for the copy button to remain fixed when code blocks are scrolled, similar to gitbook. Haven't yet worked out the custom css to make that happen.


By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('bookdown'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/bookdown').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bs4_book 🥾featurea feature request or enhancementnextto consider for next release

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions