dreamRs / dreamRs/capture

Checkboxes not captured

Open
#9 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
32
Forks
3
PR merge metrics
No merged PRs in 30d

Description

`capture` is great! It addresses the key issue I was having with `snapper` https://github.com/yonicd/snapper/issues/4 and `shinyscreenshot` https://github.com/daattali/shinyscreenshot/issues/4 due to https://github.com/niklasvh/html2canvas/issues/1595

Unfortunately, I did run into a couple of issues with `capture`. When using BS 3, checkboxes are not captured in the screenshot.

![image](https://user-images.githubusercontent.com/2998956/170853381-fefa3517-c81e-4dee-89ea-b598a0f6bad3.png)

When using BS 4, checkboxes are not captured and text for a renderUI element is wrapped and spacing is off

![image](https://user-images.githubusercontent.com/2998956/170853400-700f4cb1-dff9-4a28-8af9-c83e43594830.png)

When using BS 5, checkboxes are captured but text for the renderUI element is wrapped and spacing is off

![image](https://user-images.githubusercontent.com/2998956/170853423-8c66a93c-4dea-4aaa-921c-15c4d81bde13.png)

Any suggestions?

cc-ing @cpsievert in case there might be a connection with `bslib`

Question: Any plans to send `capture` to CRAN?

The code used to generate the screenshots above is shown below.

```
library(shiny)
library(capture)
library(bslib)

viz_type <- c(
"Distribution" = "dist", "Density" = "density", "Scatter" = "scatter",
"Surface" = "surface", "Line" = "line", "Bar" = "bar", "Box-plot" = "box"
)

version <- 5

ui <- fluidPage(
tags$h2(paste("Bootstrap Theme", version)),
theme = bs_theme(version = version),
fluidRow(
column(
width = 2,
wellPanel(
capture(
selector = ".well",
filename = NULL, # no download client side
icon("camera"), "Take screenshot",
inputId = "screenshot",
options = list(backgroundColor = "#FFF")
),
selectInput(
inputId = "loi",
label = "Law:",
choices = c("normal", "uniform", "exponential")
),
selectInput(
inputId = "test",
label = "Test-multiple:",
choices = c("normal", "uniform", "exponential"),
selected = c("normal", "uniform", "exponential"),
multiple = TRUE,
selectize = FALSE
),
uiOutput("rui"),
checkboxGroupInput(
"cb_group",
"Checkbox group",
choices = c("a", "b", "c"),
# selected = c("a", "b", "c"),
inline = FALSE
),
checkboxInput("cb_single", "Checkbox Single", value = FALSE)
)
),
column(
width = 2,
uiOutput("out")
)
)
)

server <- function(input, output, session) {

output$out <- renderUI({
tags$img(src = input$screenshot)
})

output$rui <- renderUI({
selectInput(
inputId = "viz_type", label = "Plot-type:", choices = viz_type,
selected = viz_type[1],
multiple = FALSE
)
})

distrib_r <- reactive({
switch(
input$loi,
"normal" = rnorm(1000),
"uniform" = runif(1000),
"exponential" = rexp(1000)
)
})
}

shinyApp(ui, server)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.