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

accordion_panel_close() does not close all accordion panels when values=TRUE, unless multiple=TRUE #1181

Open
lmullany opened this issue Jan 31, 2025 · 0 comments

Comments

@lmullany
Copy link

lmullany commented Jan 31, 2025

Describe the problem

The documentation for accordion_panel_close() indicates that the param values can be set to TRUE to close all panels within the accordion identified in id. However, this behavior is not seen when the target accordion's multiple param is set to FALSE. In those instances, accordion_panel_close() with values=TRUE will only impact the last panel. This means that if the one of the non-last panels is the one panel that is open when multiple=FALSE, the call to accordion_panel_close() with values=TRUE will have no effect.

library(shiny)
library(bslib)

ui <- page(
  
  accordion(
    id = "acc",
    accordion_panel("a", card("information a")),
    accordion_panel("b", card("information b")),
    accordion_panel("c", card("information c")),
    multiple=FALSE
  ),
  input_task_button("close_all", "Close All Panels"),
)

server <- function(input, output) {
  
  observe(accordion_panel_close(id="acc", values=TRUE)) |>
    bindEvent(input$close_all)

}

shinyApp(ui = ui, server = server)

Session Info


R version 4.4.0 Patched (2024-05-26 r86651 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 22631)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C LC_TIME=English_United States.utf8

time zone: America/New_York
tzcode source: internal

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

other attached packages:
[1] bslib_0.8.0.9000 shiny_1.9.1

loaded via a namespace (and not attached):
[1] vctrs_0.6.5 cli_3.6.3 rlang_1.1.5 purrr_1.0.2 promises_1.3.0 jsonlite_1.8.9
[7] xtable_1.8-4 glue_1.8.0 htmltools_0.5.8.1 httpuv_1.6.15 sass_0.4.9 jquerylib_0.1.4
[13] tibble_3.2.1 fontawesome_0.5.2 fastmap_1.2.0 lifecycle_1.0.4 memoise_2.0.1 compiler_4.4.0
[19] fs_1.6.5 Rcpp_1.0.13 pkgconfig_2.0.3 rstudioapi_0.17.1 later_1.3.2 digest_0.6.37
[25] R6_2.5.1 pillar_1.10.1 magrittr_2.0.3 tools_4.4.0 withr_3.0.2 mime_0.12
[31] cachem_1.1.0

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

1 participant