diff --git a/src/components/accordion/accordion.component.js b/src/components/accordion/accordion.component.js index f8a1079b55..a53c9b70ce 100644 --- a/src/components/accordion/accordion.component.js +++ b/src/components/accordion/accordion.component.js @@ -64,6 +64,7 @@ const Accordion = React.forwardRef( const observer = useRef( new ResizeObserver(() => { + /* istanbul ignore else */ if (accordionContent.current) { setContentHeight(accordionContent.current.scrollHeight); } @@ -73,7 +74,7 @@ const Accordion = React.forwardRef( useEffect(() => { const observerRef = observer.current; const referenceRef = accordionContent.current; - observer.current.observe(referenceRef); + observerRef.observe(referenceRef); return () => { observerRef.unobserve(referenceRef);