Skip to content

Dynamically inserted tabs fail to render when navbarMenu() is present  #3516

@andresrcs

Description

@andresrcs

System details

Browser Version: Chrome 94.0.4606.61 (Build oficial) (64 bits)

Output of sessionInfo():

R version 4.1.1 (2021-08-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3

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

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

other attached packages:
[1] shiny_1.7.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7          jquerylib_0.1.4     bslib_0.3.0         compiler_4.1.1      later_1.3.0        
 [6] shinyauthr_1.0.0    tools_4.1.1         odbc_1.3.2          digest_0.6.28       bit_4.0.4          
[11] jsonlite_1.7.2      evaluate_0.14       lifecycle_1.0.1     pkgconfig_2.0.3     rlang_0.4.11       
[16] DBI_1.1.1           xfun_0.26           fastmap_1.1.0       withr_2.4.2         stringr_1.4.0      
[21] knitr_1.35          sass_0.4.0          vctrs_0.3.8         htmlwidgets_1.5.4   hms_1.1.1          
[26] bit64_4.0.5         DT_0.19             fontawesome_0.2.2   R6_2.5.1            rmarkdown_2.11     
[31] blob_1.2.2          magrittr_2.0.1      scales_1.1.1        promises_1.2.0.1    ellipsis_0.3.2     
[36] htmltools_0.5.2     mime_0.12           xtable_1.8-4        colorspace_2.0-2    httpuv_1.6.3       
[41] stringi_1.7.4       shinyFeedback_0.4.0 munsell_0.5.0       cachem_1.0.6    

Example application or steps to reproduce the problem

library(shiny)

ui <- navbarPage(title = "Test",
                 id = "tabs",
                 collapsible = TRUE
)

server <- function(input, output) {
    appendTab("tabs", tabPanel("Tab 1",
                               h1("Tab 1")
                               ),
              select = TRUE)
    appendTab("tabs", navbarMenu("Tabs 2, 3",
                                 tabPanel("Tab 2",
                                          h1("Tab 2")
                                 ),
                                 tabPanel("Tab 3",
                                          h1("Tab 3")
                                 ))
    )
    appendTab("tabs", tabPanel("Tab 4",
                               h1("Tab 4")
                               )
              )
    appendTab("tabs", tabPanel("Tab 5",
                               h1("Tab 5")
                               )
              )
}

shinyApp(ui = ui, server = server)

Describe the problem in detail

After upgrading to shiny 1.7 dynamically inserted tabs fail to render when they are inserted two slots after a navbarMenu(). In the above reprex "Tab 5" is never rendered and "Tab 4" is shown instead. If I downgrade to shiny 1.6 it works as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions