-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Require parent blocks #17205
Comments
@coreyworrell Thanks for creating the issue. I was wondering from what point of view you're creating this issue, are you someone creating custom blocks, developing a theme, or is this functionality you think should be built in to the editor for every user? |
@talldan I am mainly developing a theme, but it would apply to all three of the cases you mentioned. Having consistent html output (ie: a non-section block must always be nested inside of a section block, etc) helps immensely for styling. |
@coreyworrell - it would have the side effect of making the HTML produced by the editor a lot less clean. It might be worth tracking this issue #16271 which discusses how to bring more grid like features into the editor. |
I think it would make the HTML “cleaner”, as it would be more reliable and
consistent. It would also just be opt-in. But yes, that Grid system may
take care of it if it ever gains traction. This may be easier to implement
short-term though.
|
With no further discussion on this in almost 4 years - I'm going to close it and defer to #16271 which discusses layout options. |
Is your feature request related to a problem? Please describe.
It is difficult to code for wide and full width blocks because blocks can be anything and have no shared "structure".
Describe the solution you'd like
Ability to require a block to be the root of other blocks. Example, every block must be added within a root "Section" block. Or even better, require that a "Section", "Row", and "Column" block be parents before you can choose to insert a "content" block. This is how basically all current page builder plugins work.
Describe alternatives you've considered
Normally, content is output inside a "container" element to restrict the maximum width and center within viewport.
Now if you add a "wide" block inside of the container, you have to use CSS to "break it out" of the container and keep it centered.
Or, alternatively, you do not wrap Gutenberg content in a container, and now have to apply some CSS like
.gutenberg-content > *
to apply themax-width
andmargin: auto
code to, which may likely interfere with certain block's CSS (think Bootstrap rows with negative margins, etc).Here is the basic HTML Gutenberg outputs now:
compared to what would be preferred:
The text was updated successfully, but these errors were encountered: