daattali / shinyjs

💡 Easily improve the user experience of your Shiny apps in seconds
https://deanattali.com/shinyjs
Other
728 stars 119 forks source link

When disabled() a Panel, downloadbutton not affected #223

Closed crosspolar closed 3 years ago

crosspolar commented 3 years ago

When using shinyjs::disabled() with a Panel, it disables textinputs and actionbuttons like expected. However, downloadButtons get ignored and stay enabled. If you put the downloadButton solely into disabled though, it works like in originally posted by @daattali in https://github.com/daattali/shinyjs/issues/132#issuecomment-46767938.

MWE:

library(shiny)

ui <- fluidPage(
  shinyjs::useShinyjs(),
  shinyjs::disabled(
    wellPanel(
      id = "test_panel",
      downloadButton("testdw", "testdw"),
      actionButton("testab","testab"),
      textInput("testtext","testtext")
    )
    )
)

server <- function(input, output, session) {
  output$test <- downloadHandler(
    filename = "test.csv",
    content = function(con) {
      write.csv(mtcars, con)
    }
  )
}

shinyApp(ui, server)

grafik

daattali commented 3 years ago

Thanks, should be fixed now