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

bs4SidebarMenuItem condition is not respected when it has sub-items #320

Open
lanceupton opened this issue Nov 16, 2022 · 0 comments
Open
Labels
bug Something isn't working

Comments

@lanceupton
Copy link

Details of Issue

When a conditional bs4SidebarMenuItem contains one or more bs4SidebarMenuSubItems, the condition argument seems to be ignored and that tab remains visible always.

Here, "Tab A2" shouldn't be displayed:
image

Here, observe the "Tab A1" (with no sub-items) behaves correctly and only displays when the appropriate condition is met:
image

Reprex

library(shiny)
library(bs4Dash)
shinyApp(
  ui = bs4DashPage(
    header = bs4DashNavbar(disable = TRUE),
    sidebar = bs4DashSidebar(
      bs4SidebarMenu(
        bs4SidebarMenuItem(
          text = "Tab 1",
          tabName = "tab1"
        ),
        bs4SidebarMenuItem(
          text = "Tab A1",
          tabName = "taba1", 
          condition = "input.show == true"
        ),
        # This tab remains visible even when input$show == FALSE
        bs4SidebarMenuItem(
          text = "Tab A2", 
          tabName = "taba2",
          condition = "input.show == true",
          bs4SidebarMenuSubItem(text = "Subtab A2", tabName = "subtaba2")
        )
      )
    ),
    body = bs4DashBody(
      checkboxInput("show", "Show 'A' Tabs")
    )
  ),
  server = function(input, output, session) {}
)

Session Info

R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
[1] bs4Dash_2.1.0 shiny_1.7.3  

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7        digest_0.6.28     later_1.3.0       mime_0.12         R6_2.5.1          jsonlite_1.7.2    lifecycle_1.0.1   xtable_1.8-4      magrittr_2.0.1   
[10] cachem_1.0.6      rlang_1.0.2       cli_3.3.0         renv_0.15.5       fontawesome_0.4.0 promises_1.2.0.1  jquerylib_0.1.4   bslib_0.3.1       ellipsis_0.3.2   
[19] tools_4.1.2       rsconnect_0.8.24  httpuv_1.6.3      fastmap_1.1.0     compiler_4.1.2    htmltools_0.5.2   sass_0.4.0     
@DivadNojnarg DivadNojnarg added the bug Something isn't working label Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants