aem-core-wcm-components icon indicating copy to clipboard operation
aem-core-wcm-components copied to clipboard

Added items to Accordion/Carousel/Tabs should always be wrapped with a Container

Open HitmanInWis opened this issue 1 year ago • 2 comments

Once a Tab or Accordion Item or Carousel slide is created as something NOT a container, there’s no way to add more items to that Tab/Item/Slide and no way to convert it to a container. Also, there is no way to add a background color/image (container properties).

This, plus the fact that the default Accordion/Tabs extensions in the AEM project maven archetype include a cq:template with 2 items that are both Container when first added to a page, we really should consider having all children of these components be Container. It might also be a boon to FE devs that can now count on all Accordion/Tab/Carousel children to be Container.

HitmanInWis avatar Jun 07 '24 14:06 HitmanInWis

I was able to resolve this for my own project by creating a SlingPostProcessor that detects when an Accordion/Tab/Carousel component is having a child added that is not a Container, and converting that component to a Container with a new node beneath it for the created resource.

i.e. Accordion

  • Container
  • Container
  • Title (new)
  • Container (new
  • Text (new)

becomes Accordion

  • Container
  • Container
  • Container -- Title
  • Container
  • Container -- Text

HitmanInWis avatar Jun 07 '24 14:06 HitmanInWis

Not sure how they managed to get the Accordion authoring experience so wrong. The authors just want to see the accordion container where they can drop stuff into. All Accordions should be expanded in Edit mode so authors can easily preview the content.

Right now they have to

  1. Edit the Accordion
  2. Click Add Item
  3. Pick "Container" from a long list of components
  4. Give the item a name (but it is actually the title, not a name)
  5. Click Done to close the dialog
  6. The accordions are all collapsed for some reason. Need to find the hidden "Select Panel" button to reveal that panel (this also collapses all the other panels)
  7. Finally they can edit the accordion content

juw177 avatar Jun 25 '24 00:06 juw177