1

I have a problem when I use modalDialog in shiny and sankeyNetwork (networkD3). If the sankeyNetwork is rendered in the app then modalDialog doesn`t appear - I can see only grey screen but without dialog window.

Click Show Modal when sankeyNetwor is visible

Click Show Modal when sankeyNetwork is not visible

Example of app to show described problem below.

library(shiny)
library(networkD3)

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

  observeEvent(input$show_modal,{
    showModal(modalDialog(
      title = NULL, size = "m",
      h4("Test Window"),
      footer = NULL, easyClose = T
    ))
  })

  output$sankey <- renderSankeyNetwork({
    nodes<-data.frame(
      name=paste0(rep("opt",9),seq(1,9)), stringsAsFactors = F)

    links<-data.frame(
      source=c(0,0,0,1,1,2,2,3,4,4,5,6),
      target=c(4,5,6,5,6,4,6,6,7,8,7,8),
      value=c(2,3,5,1,2,3,1,6,1,3,7,4))

    quest<-list(nodes=nodes, links=links)
    sankeyNetwork(Links = quest$links, Nodes = quest$nodes, Source = "source",
                  Target = "target", Value = "value", NodeID = "name",
                  units = "opt", fontSize = 16, nodeWidth = 30, iterations = 2, sinksRight = T)
  })

  output$show_sankey<-renderUI({
    if(input$show_sankeyNetwork_box) sankeyNetworkOutput('sankey')
  })

}

ui <- fluidPage(titlePanel("Modaldialog + sankeyNetwork (networkD3) Problem"),
                sidebarLayout(
                  sidebarPanel(
                    actionButton("show_modal", "Show modal"),
                    checkboxInput('show_sankeyNetwork_box', "Show sankeyNetwork", value = F)),
                  mainPanel(
                    uiOutput('show_sankey'))
                ))

shinyApp(ui = ui, server = server)

Do you know how to deal with this issue ?

Thanks !

Bartek

CJ Yetman
  • 8,373
  • 2
  • 24
  • 56
spokowodza
  • 23
  • 3
  • Possible duplicate of [Shiny App-showModal does not pop up with renderSankeyNetwork](https://stackoverflow.com/questions/46252133/shiny-app-showmodal-does-not-pop-up-with-rendersankeynetwork) – CJ Yetman May 23 '18 at 08:14
  • Yes, thank you very much. It`s exactly this case. – spokowodza May 23 '18 at 18:43

1 Answers1

0

This issue has been resolved with the dev version of shiny and should be released on CRAN soon as shiny v1.3.3.

CJ Yetman
  • 8,373
  • 2
  • 24
  • 56