Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Widget HTML containers have visibility:hidden; when an error is rendered #490

Closed
cpsievert opened this issue Dec 12, 2024 · 1 comment
Closed

Comments

@cpsievert
Copy link
Collaborator

cpsievert commented Dec 12, 2024

Discovered via rstudio/shiny#4115 (comment)

For example, note how, because of the req(), no spinner appears. The underlying reason is that htmlwidgets.js adds visibility:hidden; to the widget container when the error gets rendered, and doesn't clear that style until the next value gets rendered.

library(shiny)
library(plotly)

ui <- fluidPage(
  useBusyIndicators(),
  actionButton("run_plotly", "Run plotly"),
  plotlyOutput("p")
)

server <- function(input, output, session) {
  output$p <- renderPlotly({
    validate(need(input$run_plotly, "Please run plotly"))
    Sys.sleep(3)
    plotly::plot_ly()
  })
}

shinyApp(ui, server)
cpsievert added a commit to cpsievert/htmlwidgets that referenced this issue Dec 12, 2024
…ror and clearError method defaults

By removing these defaults, when the widget is in rendered in Shiny, it will simply fallback to Shiny's OutputBinding default methods, which does a better and simpler job of rendering and clearing errors.

And, when rendering statically, the renderError/clearError methods aren't relevant
@cpsievert
Copy link
Collaborator Author

I think this is just the way it needs to be done unfortunately

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant