File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
1616* Fixed ` ui.tooltip() ` 's ` options ` parameter to properly pass Bootstrap tooltip options to the underlying web component. (#2101 )
1717
18+ * Revised ` accordion() ` 's ` open ` logic to close all panels when an empty list is passed. (#2109 )
19+
1820## [ 1.5.0] - 2025-09-11
1921
2022### New features
Original file line number Diff line number Diff line change @@ -255,11 +255,17 @@ def accordion(
255255 binding_class_value = {"class" : "bslib-accordion-input" }
256256
257257 accordion_id = resolve_id_or_none (id )
258+ has_restored_input = not isinstance (
259+ restore_input (accordion_id , MISSING ), MISSING_TYPE
260+ )
258261 open = restore_input (accordion_id , open )
259262
260263 is_open : list [bool ]
261- if open is None :
262- # Open the first panel by default
264+ if has_restored_input and open is None :
265+ # None from restore_input indicates all panels closed
266+ is_open = [False ] * len (panels )
267+ elif open is None :
268+ # otherwise None indicates default behavior (open first panel)
263269 is_open = [i == 0 for i in range (len (panels ))]
264270 elif isinstance (open , bool ):
265271 is_open = [open ] * len (panels )
You can’t perform that action at this time.
0 commit comments