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

navlistPanel in right controlbar not behaving as expected #127

Closed
markuszinser opened this issue Apr 15, 2021 · 1 comment
Closed

navlistPanel in right controlbar not behaving as expected #127

markuszinser opened this issue Apr 15, 2021 · 1 comment

Comments

@markuszinser
Copy link

Hi,

I experienced a weird behavior with the latest version 2.0.0. If I create a right sidebar and add a navlistPanel, the input value of the navlistPanel does not correspond to the value of the tabPanel (see: https://shiny.rstudio.com/reference/shiny/0.14/tabsetPanel.html). Instead it returns the selected row number. It seems to work for a tabsetPanel. and it worked in the previous version. A shiny-only example also seems to work.

I created a small example app which reproduces the behavior:

library(shiny)

ui <- shinydashboardPlus::dashboardPage(
    header = shinydashboardPlus::dashboardHeader(),
    sidebar = shinydashboardPlus::dashboardSidebar(),
    body = shinydashboard::dashboardBody(),
    controlbar = shinydashboardPlus::dashboardControlbar(
        skin = "dark",
        shinydashboardPlus::controlbarMenu(
            id = "menu",
            shinydashboardPlus::controlbarItem(
                "Tab 1",
                "Welcome to tab 1",
                shiny::tabsetPanel(id = "my_tabset")
            ),
            shinydashboardPlus::controlbarItem(
                "Tab 2",
                "Welcome to tab 2",
                shiny::navlistPanel(id = "my_navlist")
            )
        )
    ),
    title = "Right Sidebar"
)

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

    appendTab(
        inputId = "my_tabset",
        tab = shiny::tabPanel(
            title = "tab1",
            value = "tab1"
        )
    )

    appendTab(
        inputId = "my_tabset",
        tab = shiny::tabPanel(
            title = "tab2",
            value = "tab2"
        )
    )

    appendTab(
        inputId = "my_navlist",
        tab = shiny::tabPanel(
            title = "tab1",
            value = "tab1"
        )
    )

    appendTab(
        inputId = "my_navlist",
        tab = shiny::tabPanel(
            title = "tab2",
            value = "tab2"
        )
    )

    observe({
        print("Selected Tabset: ")
        print(input$my_tabset)
        print("Selected Navlist: ")
        print(input$my_navlist)
    })
})


shinyApp(ui = ui, server = server)

If you switch in the second tab between the items in the list, a number is printed instead of the value of the tabPanel.

@DivadNojnarg
Copy link
Member

Hi,

Thanks. This one was subtile! There was a conflict with the navPills() JS binding, which was overwriting the shiny::navlistPanel binding...

As a side note, I would not advise to insert a navlist panel inside a sidebar. There is not enough space for proper rendering.

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