-
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
Synced Patterns: Not receiving alignment attribute in editor #8288
Comments
I am able to reproduce this. |
Looks like |
@youknowriad @noisysocks could I get a bit of feedback here? The reusable block is got with the |
oook, so that's not quite the problem. I'm still investigating, but it looks like when the block is rendered, the align isn't applied because it's taking the |
Yeah, that seems to be the problem. When the filters are applied, they get Not sure how to handle this one yet. |
I can explain why this is happening. I don't know that we can get this fixed for 5.0, but perhaps we can for 5.0.1. But it's important to note — this is an issue isolated to the editor, the front-end view will still render correctly. All blocks in the editor have a max-width, and are centered. Blocks with If you convert a wide image into a reusable block, it is now a wide image wrapped in a reusable block container. I.e. the image inside the container still has a wide alignment, but it is now constrained by the parent block, the reusable block container, which has the same max-width as any other normal block. I can think of two ways to fix it:
2 is arguably the best user experience, but is probably also the most complex. 1 is relatively trivial to implement, but is arguably a little confusing. But it still might be the best way to do it. Assigning for some design feedback. |
It's not specific to align either, any feature applied with the |
If we had access to the CSS |
Note that a reusable block can consist of several blocks, which complicates things. What should the
That's right, the editor will use the We could have |
It is not unlikely that I'm missing something, so forgive me if I am. But what I'm suggesting in #8288 (comment), to clarify, is that _no matter the blocks inside a reusable group Is that not right? In other words, a "fix" could be either:
To elaborate on 2, if you have 10 blocks in a reusable group, and one of them has align-wide, it's enough that the reusable block group receives align-wide. If one of them has full-wide, it's enough that the reusable block group receives full-wide. |
I moreso just wanted to drop a note to remind ourselves (myself?) that 1 reusable block ≠ 1 block 🙂 You're totally right, and either of the two fixes you described would fix the issue.
This is easy to do, but it wouldn't be the best UX as you say 🙂
I'd much prefer this if we can get it to work. The challenge is that alignment is calculated by looking at the block's |
Thank you for the sanity check and clarification. I agree the 2nd option is the nicer one. But the 1st option would be one we could implement right now, if this needed an urgent fix. However given that it's "only" an visual inconsistency in the editor, and the front-end works as it should, I wouldn't call it critical enough to rush a fix for. |
Can I add that this also happens for left/right aligned blocks. As a quick example - add an Image block, align it to left and make it 50% width, then turn it into a reusable block. The reusable block will now show as full-width even though on the frontend it's 50% and floated. Is there a reason reusable blocks don't have the standard block's |
I'm removing the "Needs Design Feedback" label since it appears we're not in a rush on this, and number 2 above seems like the direction we want to go.
|
@youknowriad I started looking into this as it somewhat limits the utility of the new Section Block. Could you advise at a high level how it might be possible to dynamically set an align attribute on the |
What about this: If the full/wide attribute is detected, then the pattern is inserted within a group block with said alignment applied? |
This would solve the frontend issue, but not the Editor, I believe. The wrapper around the synced pattern in the Editor causes issues with alignment controls and layout. |
Why is this wrapper not treated like the Template part block, which does allow for alignment width controls when nested in Group blocks? Aren't they quite similar? CleanShot.2023-06-27.at.19.39.52.mp4 |
@richtabor What I'm hearing is that you basically want a reusable block to save "attributes" that will be applied to the instance depending on its context:
-- To simplify we could say that we only save a single "position" attribute, so a reusable block can't have both "align: full" and "flex-self" (which would allow us to continue using the existing storage mechanism. Worth noting though that, A user can decide to change the "alignment" on the instance and it won't be saved again within the reusable block (it's just an instance value, and the value saved within the reusable block saves as "initial value"). I think this could work, but I also think that in order to do this properly, we need to "normalize" position attributes. In other words, the block-editor would know about these attributes and consider them "special". In face, there's a number of behaviors that could be added to these attributes:
I think it's a lot of work but it's doable. First step being to unify these attributes. |
From a pragmatic perspective, currently using reusable blocks means that the block inside will always be constrained to content width, regardless whether it is aligned widely or fully. This requires additional editor styles for forcing the reusable block wrapper to be wide enough. |
Folks testing Beta 3 are stumbling onto this issue: #52312. |
Hey folks, I hit this width/alignment issue on the very first synced pattern I tried to create. I'm also working with a group of testers for my upcoming theme, and they've all encountered this quirk independently as well. Based on the many wide-width patterns folks are creating, unfortunately it's going to be an issue they run into right away. I don't have a proposed solution outside of what's already being discussed here (great thoughts so far), but for the sake of optics around this powerful new feature, I'm hoping we can get some priority because of how visible this quirk is. Happy to throw around ideas and test POCs. Synced patterns are the talk of the town in my circles! People seem to be more excited about them than they were about regular ol' patterns. 😅 |
This issue has been happening in our projects since the beginning of 2019, which makes reusable blocks (and now synced patterns) unusable for every block-based project we've ever created. (As reported in #52893, the issue is always present in every client block theme we've ever built, as well as other public themes.) |
How did folks get around this previously? Or has this always been an issue — but now that synced patterns are more front-and-center in 6.3, it's become bigger? |
The only solution is to place a synced pattern inside of a Group block with the layout toggle disabled. This will make the synced pattern fill the Group, and then you can set alignment on the Group. It's a fairly convoluted workaround that is not intuitive to most users. My sense is that folks who ran into this issue with reusable blocks just moved on, perhaps to just normal (unsynced) patterns. I know I did. But now that synced patterns are font-and-center, as well as the talk about partially-synced patterns, this issue becomes far more problematic. |
I personally simply stopped using reusable blocks since I opened this issue because their use was greatly diminished for my requirements. Fingers crossed something can be worked out with synced patterns becoming a thing. |
We use them for ourselves and understand the quirk, but we don't teach clients or theme customers about it. We sort of pretend it's not a thing because it's been too confusing for the ones we show. |
The only workarounds I could find previously involved extra grouping as @ndiego mentions. However, I was hesitant to share this with users as a fix because it seemed a bit too hacky and folks were already having a hard enough time with the group/alignment/content width setting. |
This is from one of the 6.3 release videos; shows the issue occurring right off: CleanShot.2023-08-08.at.14.38.27.mp4 |
I am experiencing this as well and created an issue (#53500). I closed that issue as a duplicate b/c originally my search for synced didn't show this issue in the results. |
I encountered this problem like everyone else. And while the hack of wrapping a synched pattern block with a group block improves things somewhat, as others have said, I too think it is too difficult for consumer users. Since version 6.3, when Pattern was featured, many users will be challenged with site editing using synchronised and asynchronous patterns. I am looking forward to a solution that will not confuse users at that time, with respect to your great contribution. |
Noting that I've renamed this issue to "Synced Patterns" in light of WordPress 6.3's release and the overall reusable blocks rename to improve discoverability and, ideally, increase feedback. |
Also experiencing this issue. It would be nice to have the Synced Patterns retain their width settings, or perhaps even have an initial synced setting with some basic layout overrides (width, padding etc.) without changing the content. Maybe with some sort of reset/ovverride (of the defaults)? I can work around this myself but I know clients and regular folks are going to be stumped by this one and the issue is present in the 6.3 promotional video so it's highlighted right there. |
The primary issue here of synced patterns (formerly reusable blocks) "losing" their alignment has been addressed via #54416 so I'll close this issue for now. For some additional context, several other approaches to solving this problem were explored via:
The final approach that has been merged via #54416 effectively applies layout styles and alignments only within the editor without adopting layout block supports in a hacky way. Long term, we might wish to pursue a new |
Describe the bug
I'm attempting to use the shared blocks feature but have hit an editor specific issue with
alignfull
andalignwide
. When converting a a wide or full width block to shared, in the editor view the block looses its width. This does not apply to the front end which works fine.To Reproduce
Expected behavior
I expected the shared block to keep the current
data-align: full/wide
that non-shared blocks receive when setting the alignment. This makes it very difficult currently to use shared blocks for aligned blocks, as its not an accurate representation of how the block actually looks.Screenshots
The text was updated successfully, but these errors were encountered: