How to prevent a popover to stay when changing tabs in shiny app?

125 Views Asked by At

I have a shiny app with popovers that contain useful information on interpretation of plot output. However, i have to close the popover "manually" everytime. Otherwise the popover of tab "dash1" will stay even if i switch to tab "dash2".

library(shiny)
library(bs4Dash)



ui <- dashboardPage(
  
  dashboardHeader(title = "Dashboard",
                  titleWidth = 550,
                  disable= FALSE,
                  sidebarIcon = NULL
  ),
  
  dashboardSidebar(
    
    
    sidebarMenu(
      menuItem("dash1", tabName= "dashboard1"),
      menuItem("dash2", tabName= "dashboard2")
      
    )
  ),
  
  dashboardBody(
    tabItems(
      
      tabItem(tabName = "dashboard1",
              
              box(
                title = "Interpretation",
                popover(
                  actionButton("goButton", "Click here"),
                  title = "Important information",
                  placement = "right",
                  content = "popover text bla bla"
                  
                )
              )
      ),
      
      tabItem(tabName = "dashboard2",
              
              box(
                title = "Interpretation",
                popover(
                  actionButton("goButton2", "Click here"),
                  title = "Important information",
                  placement = "right",
                  content = "popover text bla bla"
                  
                )
              )
           )
      )
  )
)


server <- function(input, output) {
  
}


shinyApp(ui = ui, server = server)

How can i prevent this "behavior"? Do i necessarily have to specify addPopover and removePopover within the server part?

1

There are 1 best solutions below

0
On

I solved the problem with the help of this issue:

Display Text only on hover

What i need is a tooltip rather than a popover.