ebailey78 / shinyBS

Twitter Bootstrap Components for Shiny
182 stars 47 forks source link

bsModal not compatible with Shiny 1.4.0 #112

Open leipzig opened 5 years ago

leipzig commented 5 years ago

Hello, The most recent Shiny appears to break shinyBS modals

This causes a fatal javascript error with shiny_1.4.0 but works fine with shiny_1.3.2

here is a toy reprex:

library(shiny)

# Define UI for application that plots random distributions 
ui <- shinyUI(fluidPage(
  shinyBS::bsModal(id="myModal", title="", trigger="",tags$div(id="picId"), size = "large"),

  titlePanel("Hello Shiny!"),

  sidebarLayout(
    sidebarPanel(
      sliderInput("obs", 
                  "Number of observations:", 
                  min = 1, 
                  max = 1000, 
                  value = 500)
    ),

    mainPanel(
      plotOutput("distPlot")
    )
  )
))

server <- shinyServer(function(input, output) {
  output$distPlot <- renderPlot({
    dist <- rnorm(input$obs)
    hist(dist)
  })

})

shinyApp(ui = ui, server = server)
> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 9 (stretch)

Matrix products: default
BLAS:   /usr/lib/libblas/libblas.so.3.7.0
LAPACK: /usr/lib/lapack/liblapack.so.3.7.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] shiny_1.4.0

loaded via a namespace (and not attached):
 [1] compiler_3.6.1  fastmap_1.0.1   magrittr_1.5    R6_2.4.0        shinyBS_0.61    promises_1.1.0  later_1.0.0     htmltools_0.4.0 tools_3.6.1    
[10] Rcpp_1.0.2      jsonlite_1.6    digest_0.6.20   xtable_1.8-4    httpuv_1.5.2    mime_0.7        rlang_0.4.0    
nuno-agostinho commented 4 years ago

This may occur because shiny 1.4.0 upgraded jQuery from v1.12.4 to v3.4.1.

To switch back to jQuery 1 in shiny, you can use options(shiny.jquery.version = 1), as according to the changelog of shiny 1.4.0 (section Breaking changes).

leungi commented 4 years ago

@nuno-agostinho: thanks for the tip; it's on point! 🙏