Skip to content

Commit bde2e52

Browse files
author
Hadas Farhi
authored
fix bugs on allow multiple on click (mondaycom#390)
1 parent 8102861 commit bde2e52

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/components/Accordion/Accordion/Accordion.jsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,12 @@ const Accordion = forwardRef(({ children: originalChildren, allowMultiple, defau
3333
const onChildClick = useCallback(
3434
itemIndex => {
3535
if (allowMultiple) {
36-
const newExpandedItems = expandedItems;
36+
const newExpandedItems = [...expandedItems];
3737
if (isChildExpanded(itemIndex)) {
38-
newExpandedItems.pop(itemIndex);
38+
const index = newExpandedItems.indexOf(itemIndex);
39+
if (index > -1) {
40+
newExpandedItems.splice(index, 1);
41+
}
3942
} else {
4043
newExpandedItems.push(itemIndex);
4144
}

0 commit comments

Comments
 (0)