When using bslib::accordion() and bslib::accordion_panel(), as below, I have an accordion with s (say s=3) panels. I want each of the accordion_panel objects to contain an accordion, which itself contains t (say t=2) panels. No problem constructing this, as below:
Upon initiation, all three panels and each of the nested accordions are closed. As requested on the outer/parent accordion, only one accordion panel is allowed to be open (multiple=FALSE), and this works well.
However, although each of the inner accordions also have multiple=FALSE, multiple panels within these inner accordions do open (i.e. the panels in the inner accordion do not automatically close when another panel within that inner accordion is selected).
Furthemore, if we set the inner accordion to multiple=TRUE, then the outer panel will close when clicking on a closed inner panel
library(shiny)
library(bslib)
accordion(
accordion_panel(
title = "panel_1",
accordion(
accordion_panel(title = "panel_1_sub_1", HTML("panel 1, subpanel 1 content")),
accordion_panel(title = "panel_1_sub_2", HTML("panel 1, subpanel 2 content")),
open=FALSE,
multiple=FALSE # this is not working
)
),
accordion_panel(
title = "panel_2",
accordion(
accordion_panel(title = "panel_2_sub_1", HTML("panel 2, subpanel 1 content")),
accordion_panel(title = "panel_2_sub_2", HTML("panel 2, subpanel 2 content")),
open=FALSE,
multiple=FALSE # this is not working
)
),
accordion_panel(
title = "panel_3",
accordion(
accordion_panel(title = "panel_3_sub_1", HTML("panel 3, subpanel 1 content")),
accordion_panel(title = "panel_3_sub_2", HTML("panel 3, subpanel 2 content")),
open=FALSE,
multiple=TRUE # this is not working (closes parent panel)
)
),
open=FALSE,
multiple=FALSE # this is working fine
)
Thanks for the report @lmullany and for the detailed reprex. I can reproduce the problem as described. I don't have a fix at the moment, but we'll look into this soon.
Description of Problem
When using
bslib::accordion()
andbslib::accordion_panel()
, as below, I have an accordion withs
(says=3
) panels. I want each of theaccordion_panel
objects to contain anaccordion
, which itself containst
(sayt=2
) panels. No problem constructing this, as below:Upon initiation, all three panels and each of the nested accordions are closed. As requested on the outer/parent accordion, only one accordion panel is allowed to be open (
multiple=FALSE
), and this works well.However, although each of the inner accordions also have
multiple=FALSE
, multiple panels within these inner accordions do open (i.e. the panels in the inner accordion do not automatically close when another panel within that inner accordion is selected).Furthemore, if we set the inner accordion to
multiple=TRUE
, then the outer panel will close when clicking on a closed inner panelSession Info