Skip to content

Commit 47db483

Browse files
committed
fix: active collapsible not opening
fix bug causing collapsible to not auto open - Can't exactly explain why it was doing this, but in my development today I noticed that some of my non-accordion collapsibles weren't having their li's with class="active" set on them opening by default. Played around with the code a bit and found that putting these brackets back seemed to resolve it, so here we are
1 parent a100e39 commit 47db483

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/collapsible.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ export class Collapsible extends Component<CollapsibleOptions> {
6868

6969
// Open active
7070
const activeBodies: HTMLElement[] = Array.from(this.el.querySelectorAll('li.active > .collapsible-body'));
71-
if (this.options.accordion)
71+
if (this.options.accordion) {
7272
if (activeBodies.length > 0) {
7373
// Accordion => open first active only
7474
this._setExpanded(activeBodies[0]);
7575
}
76-
else {
76+
} else {
7777
// Expandables => all active
7878
activeBodies.forEach(el => this._setExpanded(el));
7979
}

0 commit comments

Comments
 (0)