Skip to content
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

Connect "Section Styling" with "Pattern Overrides"/ "Content Only" locking #62078

Closed
fabiankaegy opened this issue May 28, 2024 · 8 comments
Closed
Labels
[Feature] Block Locking The API allowing for the ability to lock/unlock blocks [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Feature] Extensibility The ability to extend blocks or the editing experience [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced

Comments

@fabiankaegy
Copy link
Member

Section Styling/Colorways is a really powerful new feature getting introduced in WordPress 6.6. Currently, it allows users to switch between the different available options via the styles Inspector Controls options.

At this point, any controls rendered inside any Inspector Controls are not accessible for a block that has contentOnly locking applied, which is also the mode used by pattern overrides.

From my understanding, the goal of contentOnly locking was to provide a simplified editing experience where a user doesn't have to think about composing blocks and configuring all the options. Instead, users can only enter content / configure very basic options.

To me, this goal would extend to switching between different color variations of a contentOnly locked area if the wrapper block that has the locking applied supports any section styles.

Because of that, I propose we combine these features and expose the "Styles" switcher for the top-level block that has content-only locking applied.

@fabiankaegy fabiankaegy added [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Feature] Block Locking The API allowing for the ability to lock/unlock blocks labels May 28, 2024
@fabiankaegy
Copy link
Member Author

@talldan @aaronrobertshaw @richtabor @jasmussen I'd love to get your take on this :)

@annezazu
Copy link
Contributor

I worry that will dilute contentOnly but I'm curious how we can help them play well together as I agree this would be a neat combination.

@aaronrobertshaw
Copy link
Contributor

Thanks for the ping @fabiankaegy 👍

At this point, any controls rendered inside any Inspector Controls are not accessible for a block that has contentOnly locking applied, which is also the mode used by pattern overrides.

I believe the zoom-out mode feature being worked on will eventually provide the ability to cycle or shuffle through available section styles. Something similar to how sections/patterns of the page might be shuffled.

There could be an issue somewhere that covers that but I couldn't put my finger on it. @scruffian, @draganescu and others might know better.

@talldan
Copy link
Contributor

talldan commented May 29, 2024

I think synced patterns right now are missing some features that allow them to act properly as sections (the missing shuffle button is one), but I think it's something that needs to be addressed.

An interesting aspect is where to apply the classname to the synced pattern for the section style, since there's no wrapping element output by the pattern block on the frontend. Perhaps the block styles for the wrapping block in a pattern are an override (it'd be an override of the classname attribute), and that's how it could work. It needs some consideration around how that's configured.

This is the exciting part though, where all the different projects that have been worked on start to converge 🎉

@fabiankaegy
Copy link
Member Author

In the context of custom builds, I don't think the shuffle button is the right solution. The experience needs to be predictable and repeatable.

As an editor, all I want to be able to do is select whether I want this section to appear with a light, dark, or primary background color.

Without this feature one would have to maintain 3 pretty much identical versions of every pattern which adds a lot of additional maintenance overhead.

An interesting aspect is where to apply the classname to the synced pattern for the section style, since there's no wrapping element output by the pattern block on the frontend. Perhaps the block styles for the wrapping block in a pattern are an override (it'd be an override of the classname attribute), and that's how it could work. It needs some consideration around how that's configured.

@talldan yeah it is an interesting challenge. The way I would love it to work is as an actual override of the style that has been applied to the wrapping element inside that pattern. So any is-style- class should get replaced with whatever section style the user selects.

@annezazu annezazu added the [Feature] Extensibility The ability to extend blocks or the editing experience label Jun 13, 2024
@scruffian
Copy link
Contributor

There could be an issue somewhere that covers that but I couldn't put my finger on it. @scruffian, @draganescu and others might know better.

I think it's just an idea that someone shared, but not much thought has been put into how exactly it would all fit together yet.

@bacoords
Copy link
Contributor

On another thread I wrote of one idea for an approach:

The templateLock attribute itself could be expanded to take an object of values

Looking at it now, I think just adding more options to the "lock" attribute would also be helpful if templateLock wasn't updated.

Regardless of the method, I think this level of extensibility will become more critical going forward. ContentOnly locking is very powerful but also very restrictive. It would be great to have more granular control when setting "templateLock" like the ability to "unlock" specific block attributes, section styles, or the inserter for innerblocks.

Right now there's two different "lock" mechanisms that have overlapping effects, but could be consolidated into one concept of "locking" templates, with settings that more closely resemble the locking we can do in theme.json.

@fabiankaegy
Copy link
Member Author

I think this one may have been resolved by #64872

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block Locking The API allowing for the ability to lock/unlock blocks [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Feature] Extensibility The ability to extend blocks or the editing experience [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced
Projects
Development

No branches or pull requests

6 participants