daattali / shinyjs

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

disabled does not carry through to fileInput #249

Closed bhogan-mitre closed 2 years ago

bhogan-mitre commented 2 years ago

Similar to #223, the disabled function does not get carried through to the nested button. The input itself is disabled, so nothing happens when you click it. But it's a bit deceptive to users to have a clickable button that is disabled.

library(shiny)

ui <- fluidPage(
  shinyjs::useShinyjs(),
  shinyjs::disabled(
    fileInput("testup", "testupload")
  )
)

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

shinyApp(ui, server)
Screen Shot 2022-05-04 at 2 46 44 AM

Do you think it would work to cast the net a little wider and add span[btn] to the set of elements that are checked when enabling/disabling? https://github.com/daattali/shinyjs/blob/master/inst/srcjs/shinyjs-default-funcs.js#L238

daattali commented 2 years ago

It took a little bit more to fix this, but it should work now. Thanks for the report.

bhogan-mitre commented 2 years ago

Great, thanks for the fix!