From 8309073e69a354626411b9643cab8e6e56629fd2 Mon Sep 17 00:00:00 2001 From: Pavel Klibani Date: Wed, 15 Nov 2023 14:30:10 +0100 Subject: [PATCH] Fix(web-react): Accordion DOM errors #DS-948 - Fixed errors about labelledById in console - Fixed basic accordion demo (all items could be opened, not just one as in other demo) --- .../Accordion/demo/AccordionBasic.tsx | 26 +++++----------- .../demo/AccordionOneItemOpenAtATime.tsx | 30 ++++--------------- 2 files changed, 14 insertions(+), 42 deletions(-) diff --git a/packages/web-react/src/components/Accordion/demo/AccordionBasic.tsx b/packages/web-react/src/components/Accordion/demo/AccordionBasic.tsx index 6cc092d780..6c3641786d 100644 --- a/packages/web-react/src/components/Accordion/demo/AccordionBasic.tsx +++ b/packages/web-react/src/components/Accordion/demo/AccordionBasic.tsx @@ -9,7 +9,7 @@ import AccordionItem from '../AccordionItem'; import toggleValueByType from './toggleValueByType'; const AccordionBasic = () => { - const [openState, setOpenState] = useState('AccordionItemExample0'); + const [openState, setOpenState] = useState(['AccordionItemExample0']); const toggle = (id: string) => { setOpenState(toggleValueByType(id, openState)); @@ -18,10 +18,8 @@ const AccordionBasic = () => { return ( - - Accordion Item no. 1 - - + Accordion Item no. 1 + Sit amet interdum, accumsan dolor sit amet posuere vel arcu mauris placerat non mauris, non sed vitae curabitur odio leo. Dignissim tristique, consequat vel arcu et nisi odio leo pretium accumsan condimentum at sem, mauris aenean aliquet enim. Neque sapien, volutpat erat id nunc facilisis eget ipsum phasellus, tellus @@ -33,8 +31,6 @@ const AccordionBasic = () => { Link @@ -44,7 +40,7 @@ const AccordionBasic = () => { > Accordion Item no. 2 - + Non suspendisse, maximus suscipit tortor non mauris bibendum felis scelerisque bibendum, nam augue scelerisque non nulla. Erat nec, integer nec egestas integer consequat cursus sed porttitor, dolor sit amet lorem ipsum consectetur porta. Condimentum urna, suspendisse mauris ligula duis id vivamus quis odio eget, integer ornare @@ -54,10 +50,8 @@ const AccordionBasic = () => { - - Accordion Item no. 3 - - + Accordion Item no. 3 + Sit amet interdum, accumsan dolor sit amet posuere vel arcu mauris placerat non mauris, non sed vitae curabitur odio leo. Dignissim tristique, consequat vel arcu et nisi odio leo pretium accumsan condimentum at sem, mauris aenean aliquet enim. Neque sapien, volutpat erat id nunc facilisis eget ipsum phasellus, tellus @@ -68,15 +62,11 @@ const AccordionBasic = () => { - 3} - > + 3}> Augue iaculis, quis ante sapien aliquam aliquam non cursus, vestibulum nunc ipsum maximus. Libero sed non nulla, condimentum lorem ipsum molestie integer curabitur rutrum curabitur, tellus pulvinar libero tempus - + Non suspendisse, maximus suscipit tortor non mauris bibendum felis scelerisque bibendum, nam augue scelerisque non nulla. Erat nec, integer nec egestas integer consequat cursus sed porttitor, dolor sit amet lorem ipsum consectetur porta. Condimentum urna, suspendisse mauris ligula duis id vivamus quis odio eget, integer ornare diff --git a/packages/web-react/src/components/Accordion/demo/AccordionOneItemOpenAtATime.tsx b/packages/web-react/src/components/Accordion/demo/AccordionOneItemOpenAtATime.tsx index a885a6cabd..ff0a9622f4 100644 --- a/packages/web-react/src/components/Accordion/demo/AccordionOneItemOpenAtATime.tsx +++ b/packages/web-react/src/components/Accordion/demo/AccordionOneItemOpenAtATime.tsx @@ -16,14 +16,8 @@ const AccordionOneItemOpenAtATime = () => { return ( - - Accordion Item no. 1 - - + Accordion Item no. 1 + Sit amet interdum, accumsan dolor sit amet posuere vel arcu mauris placerat non mauris, non sed vitae curabitur odio leo. Dignissim tristique, consequat vel arcu et nisi odio leo pretium accumsan condimentum at sem, mauris aenean aliquet enim. Neque sapien, volutpat erat id nunc facilisis eget ipsum phasellus, tellus @@ -34,14 +28,8 @@ const AccordionOneItemOpenAtATime = () => { - - Accordion Item no. 2 - - + Accordion Item no. 2 + Non suspendisse, maximus suscipit tortor non mauris bibendum felis scelerisque bibendum, nam augue scelerisque non nulla. Erat nec, integer nec egestas integer consequat cursus sed porttitor, dolor sit amet lorem ipsum consectetur porta. Condimentum urna, suspendisse mauris ligula duis id vivamus quis odio eget, integer ornare @@ -51,14 +39,8 @@ const AccordionOneItemOpenAtATime = () => { - - Accordion Item no. 3 - - + Accordion Item no. 3 + Sit amet interdum, accumsan dolor sit amet posuere vel arcu mauris placerat non mauris, non sed vitae curabitur odio leo. Dignissim tristique, consequat vel arcu et nisi odio leo pretium accumsan condimentum at sem, mauris aenean aliquet enim. Neque sapien, volutpat erat id nunc facilisis eget ipsum phasellus, tellus