Description
Issue Overview
The allowedBlocks
attribute of <InnerBlocks />
is intended to only allow certain blocks to be inserted into a block. However, by pressing Enter or by using the sibling inserter(fixed by #7226), you can still insert the default block: the Paragraph block.
Steps to Reproduce (for bugs)
- Create a block type containing
<div><InnerBlocks allowedBlocks={ [ 'core/list' ] } /></div>
in its editor markup and<div><InnerBlocks.Content /></div>
in its saved markup. This block should allow only allow List blocks to be inserted into it as children. - Insert the block into a post.
- Insert multiple List blocks into the container block.
- Try using
the sibling inserter orEnter to insert a Paragraph block. - Notice that, although the Paragraph block is not shown in the inserter pop-up, it can still be inserted.
Expected Behavior
A block that sets allowedBlocks
in its <InnerBlocks />
component should only allow the blocks listed in allowedBlocks
to be inserted into it. Of course, the question of how to still use slash commands and/or the sibling inserter arise, as both involve inserting Paragraph blocks.
Current Behavior
Using Enter or the in-between inserter, you can insert any block into a block with an <InnerBlocks />
component.
Related Issues and/or PRs
- Implement nesting in cover image block #5452
- Introduce Child Blocks #5540
- Add shared blocks to the blocks autocompleter #6067
- Blocks should only be able to be transformed into other allowed blocks. #6363
- List Block: Try nesting with InnerBlocks #6394
- Use nested blocks for quotes #6520
- Replace default block appender in nested blocks with in-between inserter #6834
- Only show transforms to blocks that can be inserted on the root block; Order transforms by frecency; #7184
- Hide insertion point if it is not possible to insert the default block #7226
- InnerBlocks have no inserter when core/paragraph is not in allowedBlocks #7763
Update: 2018-07-13
Updated this issue to no longer cover the slash command bug, which was already covered by #6070 and was fixed by #6067.