-
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
Update template part block to behave more like pattern block #68042
base: trunk
Are you sure you want to change the base?
Update template part block to behave more like pattern block #68042
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +17 B (0%) Total Size: 1.84 MB
ℹ️ View Unchanged
|
I support the principle for the unification aspect. I have a recollection that there may have been made an exception so that you could edit the inner contents of headers or footers, in visual context of the full page. Perhaps @richtabor recalls the context. |
I appreciate that this aligns the template part edit UX across page + template editing. I think that consistency really helps indicate the global aspect of template parts. A missing piece is being able to edit a template part while the rest of the page is visible. But that's an issue on trunk too, so I'm not sure it should hold up this PR. It might be simple to address with an 'Edit in place' option that essentially spotlights the template part and paints a scrim of the rest of the page. This would potentially work well for patterns too. |
I'd love to wait until Rich chimes in, as it's effectively a revert of the exception to the behavior. |
I'm still a bit stuck on this. This is part of why I wanted to migrate these blocks over to use bindings (#67260). The PR had a lot of negative comments. But it still makes sense to me. Pattern Overrides are a type of binding, and the presence of the binding is how we determine a block has contentOnly editing in a synced pattern instance. Similarly, blocks with post meta bindings are also editable in a synced pattern. So if we make Site title, logo, tagline have bindings, they'll also become editable in patterns (and template parts after this PR). |
What?
Part of #65698
When editing a synced pattern, the design of the pattern is locked, and a user has to click 'Edit original' to change the design.
This PR makes template parts work the same way, and this is mostly changing the experience when editing a template where the inner blocks of template parts can be freely edited.
Problems
From testing this change, the main issue I see is that some of the inner blocks types like Site Title, Site Logo and poss. also navigation should be editable, similar to if they had pattern overrides enabled.
I'm not sure the best way to resolve that, there's no API/mechanism for making this possible currently. 🤔
Likely need something new here, maybe a private block supports API.
Why?
@youknowriad suggested that it'd be good to tackle this (#67372 (comment), #67372 (comment))
This ties in with some separate conversations that have been ongoing:
How?
The implementation is very straightforward and I can follow up with some e2e tests if there's agreement on the change. A couple of place in the code are updated to:
Testing Instructions
Screenshots or screencast
Kapture.2024-12-17.at.16.46.31.mp4