rstudio / bslib

Tools for theming Shiny and R Markdown via Bootstrap 3, 4, or 5.
https://rstudio.github.io/bslib/
Other
466 stars 57 forks source link

Using bslib::bs_theme unhides hidden tabnames #377

Closed vincentvanhees closed 2 years ago

vincentvanhees commented 2 years ago

Hello, I would like to report some odd behaviour when using bslib::bs_theme() in combination with "hidden" tabs in Shiny:

The code below generates this Shiny app:

image However, when I uncomment the line theme = bslib::bs_theme(bootswatch = NULL), I get:

image It displays the tabnames which is not what should happen.

library("shiny")
ui <- fluidPage(
# theme = bslib::bs_theme(bootswatch = NULL),
  tabsetPanel(
    id = "wizard",
    type = "hidden",
    tabPanel("page_1",
             "Welcome!",
             actionButton("page_12", "next")
    ),
    tabPanel("page_2",
             "You're done!",
             actionButton("page_21", "prev")
    )
  )
)
server <- function(input, output, session) {
  switch_page <- function(i) {
    updateTabsetPanel(inputId = "wizard", selected = paste0("page_", i))
  }
  observeEvent(input$page_12, switch_page(2))
  observeEvent(input$page_21, switch_page(1))
}
shinyApp(ui, server)

Additional info:

This behavior occurs in both Windows and Ubuntu, see sessionInfo below. and it occurs with both bslib 0.3.0 and 0.3.1. When I try bslib 0.2.5.1 I get: Error: 'navs_hidden' is not an exported object from 'namespace:bslib'.

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/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

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

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

other attached packages:
[1] HabitusGUI_0.1.0 testthat_3.1.0   shiny_1.7.1     

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7        bslib_0.3.1       compiler_4.1.1    pillar_1.6.3      later_1.3.0      
 [6] jquerylib_0.1.4   tools_4.1.1       digest_0.6.28     pkgload_1.2.3     jsonlite_1.7.2   
[11] lifecycle_1.0.1   tibble_3.1.5      pkgconfig_2.0.3   rlang_0.4.11      rstudioapi_0.13  
[16] cli_3.0.1         fastmap_1.1.0     withr_2.4.2       GGIR_2.4-3        desc_1.4.0       
[21] sass_0.4.0        fs_1.5.0          vctrs_0.3.8       shinyFiles_0.9.0  rprojroot_2.0.2  
[26] glue_1.4.2        data.table_1.14.2 R6_2.5.1          fansi_0.5.0       magrittr_2.0.1   
[31] promises_1.2.0.1  ellipsis_0.3.2    htmltools_0.5.2   mime_0.12         xtable_1.8-4     
[36] httpuv_1.6.3      utf8_1.2.2        cachem_1.0.6      crayon_1.4.1 

R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

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

other attached packages:
[1] shiny_1.7.1

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7       magrittr_2.0.1   xtable_1.8-4     R6_2.5.1         rlang_0.4.11    
 [6] fastmap_1.1.0    fansi_0.5.0      tools_4.1.1      utf8_1.2.2       jquerylib_0.1.4 
[11] withr_2.4.2      htmltools_0.5.2  ellipsis_0.3.2   digest_0.6.28    tibble_3.1.5    
[16] lifecycle_1.0.1  crayon_1.4.1     later_1.3.0      vctrs_0.3.8      sass_0.4.0      
[21] promises_1.2.0.1 fs_1.5.0         cachem_1.0.6     mime_0.12        compiler_4.1.1  
[26] bslib_0.3.1      pillar_1.6.3     jsonlite_1.7.2   httpuv_1.6.3     pkgconfig_2.0.3 

Credits: The code example above is a simplified version of the Mastering Shiny book paragraph about wizard.

github-actions[bot] commented 1 year ago

This issue has been automatically locked. If you believe you have found a related problem, please open a new issue (with a reproducible example or feature request) and link to this issue.