-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Rethink how the template part work and persist its properties #26392
Comments
I think conceptually it makes sense to attach properties to the template part, but perhaps there's a way to make the Group be a controlled block (always the first element) even if its properties can be set from the template part UI (they are saved instead in the Group). Would that make sense? |
I do think the challenge with nested group blocks is just that navigating nested blocks is not an ideal experience (in my opinion), so I personally prefer to avoid requiring it for common use cases. (Especially because the nested block inserters cause the UI to jump around)
One of the arguments from @Addison-Stavlo when we discussed this last was that it might be more practical to have the attributes be specific to the entity than to all template parts. Copying my comment from a different issue:
(from #22034 (comment)) I do like the idea of allowing those attributes to be global, but I'm just not sure how to make that happen, since the template part block itself is not ever global by itself
would this mean that the group block is basically "transparent" in the block editor? |
I don't think it entirely defeats their purpose. It gives settings that can be applied specifically on that template. Thus the same template part could be used on multiple templates with minor style differences (color variations, etc.). I discussed an example of how this might look in practice here: #22034 (comment):
|
The ship has sailed here. I'm closing for now. |
The template part as written today supports a number of properties:
tagName
to choose the wrapper tag: header, footer, section, div...The idea was that template parts should have similar configuration options as the group block to be able to use them properly for headers, footers, sidebars...
The problem though is that these properties are saved as regular block attributes in the comment something like:
which means they are not saved on the template part itself but on the "caller" or "template" making use of the template part. It means these semantics do not persist across the usage of the same template part, and this kind of defeats their purpose.
Potential solution
cc @noahtallen @vindl @mtias
The text was updated successfully, but these errors were encountered: