Skip to content

Commit f8075be

Browse files
feat: Enable closing accordion is already expanded
1 parent c097696 commit f8075be

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/components/DsfrAccordion/DsfrAccordion.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,14 @@ export default defineComponent({
3434
3535
methods: {
3636
toggleExpanded () {
37-
this.$emit('expand', this.id)
37+
/*
38+
* Close current accordion if expanded
39+
*/
40+
if (this.expanded) {
41+
this.$emit('expand', undefined)
42+
} else {
43+
this.$emit('expand', this.id)
44+
}
3845
},
3946
},
4047

0 commit comments

Comments
 (0)