-
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
Add element selector to template-part block #27101
Conversation
Size Change: +130 B (0%) Total Size: 1.19 MB
ℹ️ View Unchanged
|
For a better context, we tried something similar with the Group block that has |
So far I have used block variations for template-parts as a way to speed up the development when I test FSE themes and for me it has worked really well. Despite this, I think the drop down is a better solution:
I suggest the following changes: Remove the word "Wrapping" and only keep "HTML element" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code wise, it's good to go after addressing the nitpick about the default value in the TemplatePartEdit
component prop.
Moving forward, we will need a strategy to introduce unified handling for blocks to act as wrapping elements:
- Group
- Post Content
- Query
- Reusable Block
- Template Part
or blocks that can have different wrapping tag elements depending on function:
- Heading
- List
It would be great to hear from @mtias or @jasmussen on the above before we commit to anything.
(The failing e2e test was improved after the last commit pushed from this branch, rebase should resolve it)
Instead of adding a new panel called "Semantics", can we add this to the "Advanced" section? |
Done in 5f2fa20 👍 |
Done in 1b0c37d 👍 |
I think there's an opportunity to further refine this with some of the component work and systems that are outlined in #27331, but so long as this is in the advanced section and is collapsed by default, seems fine to move forward with this one as a feature addition. Nice work. |
I have just tested it and it work according to the latest suggestion from @jasmussen. Let's get this in 🎉 |
Thank you @gziolo for your testing, I'll go ahead and merge it 👍 |
Description
Fixes #27092
This PR adds a
SelectControl
to thetemplate-part
block, to allow selecting what the template-part's wrapper element should be.How has this been tested?
Tested in an FSE theme in the site editor:
Screenshots
Types of changes
SelectControl
with values that are applicable to template-partsMost of the changes in the diff are indentation changes because adding the control required nesting the elements inside a wrapper.
There are no breaking changes. We already had a
tagName
property in the block, but it required manual intervention in the HTML - which was impossible to do since the site-editor doesn't have a code view.Checklist: