RinteRface / shinybulma

🌐 Bulma.io for Shiny
https://rinterface.github.io/shinybulma/
Other
111 stars 15 forks source link

Output elements are not shown when tabs change #28

Closed thothal closed 3 years ago

thothal commented 3 years ago

Standard shiny behaviour is not to show output elements when they are hidden. However, currently they are not shown even when changing the tab.

We have to trigger a shown event to let shiny know that these elements are now active.

I will commit a PR with these changes. Furthermore, I propose to change bulmaTabs and bulmaTab such that we avoid to hardcode the labels twice.

library(shiny)
library(shinybulma)

ui2 <- bulmaPage(
   bulmaTabs(
      bulmaTab("Start", p("Nothing to see here, really")),
      bulmaTab("Calc", bulmaActionButton("do", "Calc"), verbatimTextOutput("out"))
   )
)

server2 <- function(input, output, session) {
   ## Need to comment out to make it run
   # session$onFlushed(function() {
   #    outputOptions(output, 
   #                  "out",
   #                  suspendWhenHidden = FALSE)
   # })
   output$out <- renderPrint({
      input$do
   })
}

shinyApp(ui, server)