Skip to content

navbarMenu() aren't being selected properly on pageload #3519

@nuno-agostinho

Description

@nuno-agostinho

System details

Browser Version: Safari 15.0

Output of sessionInfo():

R version 4.1.0 (2021-05-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.5 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

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

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

other attached packages:
[1] cTRAP_1.10.2   purrr_0.3.4    shiny_1.7.0    testthat_3.0.4

loaded via a namespace (and not attached):
  [1] readxl_1.3.1                  backports_1.2.1               AnnotationHub_3.0.1          
  [4] fastmatch_1.1-3               BiocFileCache_2.0.0           plyr_1.8.6                   
  [7] igraph_1.2.6                  BiocParallel_1.26.2           crosstalk_1.1.1              
 [10] usethis_2.0.1                 GenomeInfoDb_1.28.4           ggplot2_3.3.5.9000           
 [13] digest_0.6.28                 highcharter_0.8.2             htmltools_0.5.2              
 [16] fansi_0.5.0                   magrittr_2.0.1                memoise_2.0.0                
 [19] limma_3.48.3                  remotes_2.4.1                 Biostrings_2.60.2            
 [22] R.utils_2.11.0                xts_0.12.1                    prettyunits_1.1.1            
 [25] colorspace_2.0-2              blob_1.2.2                    rappdirs_0.3.3               
 [28] ggrepel_0.9.1                 xfun_0.26                     dplyr_1.0.7                  
 [31] callr_3.7.0                   crayon_1.4.1                  RCurl_1.98-1.5               
 [34] jsonlite_1.7.2                roxygen2_7.1.2                zoo_1.8-9                    
 [37] glue_1.4.2                    gtable_0.3.0                  zlibbioc_1.38.0              
 [40] XVector_0.32.0                pkgbuild_1.2.0                Rhdf5lib_1.14.2              
 [43] BiocGenerics_0.38.0           quantmod_0.4.18               scales_1.1.1                 
 [46] DBI_1.1.1                     Rcpp_1.0.7                    xtable_1.8-4                 
 [49] bit_4.0.4                     stats4_4.1.0                  DT_0.19                      
 [52] htmlwidgets_1.5.4             httr_1.4.2                    fgsea_1.18.0                 
 [55] ellipsis_0.3.2                pkgconfig_2.0.3               R.methodsS3_1.8.1            
 [58] sass_0.4.0                    dbplyr_2.1.1                  utf8_1.2.2                   
 [61] tidyselect_1.1.1              rlang_0.4.11                  reshape2_1.4.4               
 [64] later_1.3.0                   AnnotationDbi_1.54.1          munsell_0.5.0                
 [67] BiocVersion_3.13.1            cellranger_1.1.0              tools_4.1.0                  
 [70] cachem_1.0.6                  cli_3.0.1                     generics_0.1.0               
 [73] RSQLite_2.2.8                 devtools_2.4.2                broom_0.7.9                  
 [76] stringr_1.4.0                 fastmap_1.1.0                 yaml_2.2.1                   
 [79] processx_3.5.2                knitr_1.35                    bit64_4.0.5                  
 [82] fs_1.5.0                      shinycssloaders_1.0.0         KEGGREST_1.32.0              
 [85] pbapply_1.5-0                 mime_0.12                     R.oo_1.24.0                  
 [88] xml2_1.3.2                    compiler_4.1.0                rstudioapi_0.13              
 [91] filelock_1.0.2                curl_4.3.2                    png_0.1-7                    
 [94] interactiveDisplayBase_1.30.0 binr_1.1                      tibble_3.1.4                 
 [97] bslib_0.3.0                   stringi_1.7.4                 ps_1.6.0                     
[100] desc_1.4.0                    lattice_0.20-44               Matrix_1.3-4                 
[103] vctrs_0.3.8                   pillar_1.6.3                  lifecycle_1.0.1              
[106] rhdf5filters_1.4.0            BiocManager_1.30.16           jquerylib_0.1.4              
[109] data.table_1.14.2             cowplot_1.1.1                 bitops_1.0-7                 
[112] httpuv_1.6.3                  R6_2.5.1                      promises_1.2.0.1             
[115] gridExtra_2.3                 IRanges_2.26.0                sessioninfo_1.1.1            
[118] assertthat_0.2.1              pkgload_1.2.2                 fontawesome_0.2.2            
[121] rhdf5_2.36.0                  rprojroot_2.0.2               withr_2.4.2                  
[124] S4Vectors_0.30.0              GenomeInfoDbData_1.2.6        rlist_0.4.6.2                
[127] parallel_4.1.0                grid_4.1.0                    tidyr_1.1.4                  
[130] Cairo_1.5-12.2                TTR_0.24.2                    Biobase_2.52.0               
[133] lubridate_1.7.10

Example application or steps to reproduce the problem

ui <- navbarPage(
    "my app",
    id="tab",
    navbarMenu("Load", icon=icon("table"),
               tabPanel("Custom Data", "custom data: please upload"),
               "----",
               tabPanel("Public Data", "public data online")),
    navbarMenu("Analyse", icon=icon("cogs"),
               tabPanel("quick analysis", "fast!"),
               tabPanel("slow analysis", "more time")),
    navbarMenu("Visualise", icon=icon("chart-bar"),
               tabPanel("plots", "avoid pie charts")))
server <- function(input, output) {
    observe(print(input$tab))
}
shinyApp(ui=ui, server=server)

Describe the problem in detail

The current implementation of tabs with navbarPage is giving some bugs as you can see from the reproducible example.

  1. When opening the app, click in any tab inside the navigation bar. It opens as expected, but the first tab (Custom Data) is still active (blue). When trying to select the first tab (Custom Data), nothing happens.

  2. This bug is reflected by the ID of the selected tab that doesn't show correctly. When selecting a second tab, it shows the selected tab is NULL.

After clicking in some tabs, the tabs start working as expected again. I don't understand what is going on, any temporary workaround is appreciated. Thanks!

Metadata

Metadata

Assignees

Labels

Type: RegressionFunctionality from a previous release no longer works

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions