Regardless of how the formatter setting for the accordion item is set, either open or closed, all accordion items are closed except for the last one. Looking at field-group-accordion-item.html.twig it sets a class name on an element if the collapsed variable returns false. This should be the open accordion item but every element has this class.

The javascript for the accordion item relies on this classname for jquery ui to open the correct item. Since the class names are present on all items the last one is told to open.

You'll need to patch with this to even see the accordions https://www.drupal.org/files/issues/field_group-accordion-not-working-27...

CommentFileSizeAuthor
#3 accordion-item-fix.patch465 bytesTom Nelson
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Tom Nelson created an issue. See original summary.

Tom Nelson’s picture

I'm pretty sure I can get this. I'll send up a patch soon.

Tom Nelson’s picture

FileSize
465 bytes

I've never done this before, hope it works.

ozin’s picture

Hi did you try last patch? https://www.drupal.org/node/2729569

Tom Nelson’s picture

Ozin, yes I had to apply that patch to get the accordions to work. After applying it, the final item is always opened. The twig file I modified is expecting collapsed to be either true or false. Since what is returned is either 'open' or 'closed' it always returns true, so all tabs are told to be open. If you only allow one tab to be open at a time, then the last one is. It looks like someone has posted a similar issue https://www.drupal.org/node/2806279 what is proposed in this solution is probably better than asking what the value of collapsed is like I did in my patch.

So to get my patch to work, you have to apply the other patch first.

ozin’s picture

Did u try clear cache, works for me)

nils.destoop’s picture

Status: Active » Closed (duplicate)

Thx for the patch, but this was already fixed by #2729569: Accordion not working. Closing this issue as duplicate