• Resolved nicolalucas

    (@nicolalucas)


    I find this almost impossible to use. Each time a new item is created it embeds it into the previous one, meaning on the front end you need to open the first item to see the next one etc.. etc… It seems impossible to separate them. It’s a shame as this would be great otherwise.

    • This topic was modified 4 years, 2 months ago by nicolalucas.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author philbuchanan

    (@philbuchanan)

    This block makes use of the InnerBlocks component, which means you can nest any other block inside of an accordion. This allows to great flexibility in what elements you can place inside an accordion item. Unfortunately, I’m not currently aware of a way to limit InnerBlocks to exclude nesting another accordion item itself, but I’ll do some more research and see if I can find a suitable alternative to limit this ability and area of frustration.

    My suggestion for avoiding nesting one accordion item inside another is to confirm you are not inserting the new accordion into the InnerBlocks area of another accordion. You can use the block navigation dropdown in the top toolbar to confirm you are not nesting inside another accordion.

    One other note that may be casing some of the frustration: the first paragraph block immediately following the title of the accordion is always part of the InnerBlocks section. You will need to click below that paragraph to select outside the accordion. Simply pressing enter/return on your keyboard with that first paragraph selected will always insert another paragraph inside the existing accordions InnerBlocks area.

    Thread Starter nicolalucas

    (@nicolalucas)

    I see, that last bit explains it all. It is counter intuitive to me as pressing return usually creates a new block in Gutenberg.

    Plugin Author philbuchanan

    (@philbuchanan)

    Technically when you press return inside the accordion it is creating a new block—It is just creating that new block inside the accordion. Gutenberg allows certain blocks to be nested, so you can end up with blocks inside of other blocks. The default behaviour is to create the new block within the same context as the previous block (i.e. when you’re inside an accordion, new blocks are created inside the same accordion). This is the same behaviour you’ll see with other blocks that make use of InnerBlocks, for example the media-text block, or columns block.

    There are definitely still some oddities within the Gutenberg interface. Hopefully as it becomes more mature some of these items will be addressed. I’ll also look into other ways I can make it more clear within my block. Thanks for the feedback.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Accordion items embed into last one’ is closed to new replies.