Skip to content

Sidebar menu with dynamic content does not show default tab #71

@maelick

Description

@maelick

When using a sidebar menu dynamically generated no tab is shown by default.

Here's the example from the doc with some text added inside the dashboard bod to be able to replicate the issue:

library(shiny)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(title = "Dynamic sidebar"),
  dashboardSidebar(
    sidebarMenuOutput("menu")
  ),
  dashboardBody(tabItems(
    tabItem(tabName = "dashboard", h2("Dashboard tab content"))
  ))
)

server <- function(input, output) {
  output$menu <- renderMenu({
    sidebarMenu(id="mytabs",
      menuItem("Menu item", tabName="dashboard", icon = icon("calendar"))
    )
  })
}

shinyApp(ui, server)

By default it does not show the tab item "dashboard" and the user has to clic on it to show it. I tried to manually fix this in my app using updateTabItems but it does not work either because the sidebar menu object is not stored in the input variable (but it was in the static version).

I tested this both with the CRAN and last Github versions of shiny and shinydashboard.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions