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

When using startExpanded = TRUE the arrow icon isn't pointing downwards #382

Open
ismirsehregal opened this issue Feb 7, 2022 · 1 comment

Comments

@ismirsehregal
Copy link

ismirsehregal commented Feb 7, 2022

When using the startExpanded parameter for childfull menuItems the arrow icon is using fa-angle-left when first invoking the app (Maybe this is because the parent li.treeview tag isn't getting updated with class "active"?). Instead it should point downwards (using fa-angle-down), to be aligned with the behaviour when clicking the menuItem manually:

Animation

Example code:

library(shiny)
library(shinydashboard)

ui <- function(req) {
  dashboardPage(
    dashboardHeader(title = "Simple tabs"),
    dashboardSidebar(
      sidebarMenu(
        id = "sidebarItemSelected",
        menuItem(
          "Childfull menuItem 1",
          menuItem(
            "Childless menuItem 1",
            tabName = "childlessTab1",
            icon = icon("dashboard"),
            selected = TRUE
          ),
          # fileInput("upload", "Upload"),
          bookmarkButton(),
          expandedName = "childfullMenuItem1",
          startExpanded = TRUE
        ),
        menuItem(
          "Childfull menuItem 2",
          menuItem(
            "Childless menuItem 2",
            icon = icon("th"),
            tabName = "childlessTab2",
            badgeLabel = "new",
            badgeColor = "green"
          ),
          expandedName = "childfullMenuItem2"
        )
      )
    ),
    dashboardBody(tabItems(
      tabItem(tabName = "childlessTab1",
              h2("Dashboard tab content")),
      tabItem(tabName = "childlessTab2",
              h2("Widgets tab content"))
    ))
  )
}

server <- function(input, output, session) {
  observe({
    cat(
      paste(
        "\nsidebarItemSelected:",
        input$sidebarItemSelected,
        "\nsidebarItemExpanded:",
        input$sidebarItemExpanded,
        "\nsidebarCollapsed:",
        input$sidebarCollapsed,
        "\n"
      )
    )
  })
}

shinyApp(ui, server, enableBookmarking = "url")
@bentontripp
Copy link

I am running into the same problem if I select another menuItem before first collapsing the current menuItem.

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

No branches or pull requests

2 participants