Implementing Accordion like functionality through repeater containing a title text and container

Question:
Repeater Item Not Collapsing Properly – Extra White Space Issue

Product:
Wix Studio Editor

What are you trying to achieve:
I have a repeater where each item contains a title (toggleTitle) and an expandable details section (box45)(container containing text). When clicking the title, the details section should expand while ensuring other open repeater items which are already opened collapse(kind of like an accordion, but cannot use accordion, as accordion cannot be connected to CMS).

The goal is to remove the extra white space that appears below the title text inside all the repeater items even when the container is collapsed . In a test version, there was no unnecessary space, but in my current implementation, the repeater items do not shrink properly when collapsed and I am not able to find any difference between both the versions.

What have you already tried:

  • Used .collapse() and .expand() on box45 inside onItemReady().
  • Ensured other open items collapse before expanding the clicked one.
  • Called $w("#repeater1").layout.recalculate(); to force a layout update.
  • Checked whether setting height dynamically works (Wix doesn’t allow this).
  • Attempted to use .boundingRect.height to adjust item height dynamically, but still saw white space.

Additional information:

  • In my test site, the behavior is correct, but in the actual implementation, repeater items retain empty space even after collapsing.
  • The issue occurs when toggling multiple items—collapsed items still occupy extra space instead of shrinking fully.
  • Are there any better ways to ensure the repeater shrinks correctly without leftover spacing?

Would appreciate any insights on this thanks!!