WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.32k stars 4.12k forks source link

InnerBlocks doesn't show align wide/full controls when inside a custom block #64078

Open simom opened 1 month ago

simom commented 1 month ago

Description

I have a custom block that supports InnerBlocks, and if I remove the 'layout' support from the block.json, the InnerBlocks (which natively support wide/full alignment, like Group or Columns) no longer show the alignment toolbar control.

I have searched through tickets and tried to manually force the layout to be constrained to the innerBlockProps as suggested by @tellthemachines in this ticket https://github.com/WordPress/gutenberg/issues/43731#issuecomment-1237579857, but without success.

Am I doing something wrong?

Step-by-step reproduction instructions

Screenshots, screen recording, code snippet

No response

Environment info

Please confirm that you have searched existing issues in the repo.

Please confirm that you have tested with all plugins deactivated except Gutenberg.

SH4LIN commented 1 month ago

I think this is intentional. If the parent block (in this case, your custom block) does not support wide and full alignment, then logically, its inner blocks shouldn't support it either.

Try adding align: ['wide', 'full'] to your custom block.

simom commented 1 month ago

Hi @SH4LIN, thanks for the reply. The parent block already has alignment support. I believe this should be possible since there shouldn't be a relation between the "layout" support and the alignment in theory (I know that there is a guard in the component). Following the example from the referenced ticket, it should be possible to enable the constrained mode even if the support is not present, or at least this is how I think it should work.