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

Question: How will patterns work with custom block styles? #79

Open
carolinan opened this issue Apr 17, 2021 · 3 comments
Open

Question: How will patterns work with custom block styles? #79

carolinan opened this issue Apr 17, 2021 · 3 comments
Labels
[Component] Pattern Creator Anything related to the pattern front end editor or preview

Comments

@carolinan
Copy link

carolinan commented Apr 17, 2021

In the patterns, the creator can add attributes to the blocks, as long as the block supports it (color, font size, padding etc, and soon, borders).
But what if I want to create a pattern that needs CSS that can't be achieved with the block support?
For example, box shadow, or positioning a block so that it overlaps (See for example Twenty Twenty-One).
Or if the pattern needs to have a mobile and a desktop width style.
Then I would need to add a CSS class to the block inside the pattern and register a custom block style.

If I was making a theme or plugin, that style would break when the plugin or theme was switched, only the content and the block markup would remain on the users install. How will this be solved with the patterns?
Are the block patterns from the block pattern directory going to be accompanied with custom block styles that are saved to a global custom CSS field (think, the additional CSS field in the customizer)?
Or something else? Registered when the pattern is placed?
What would happen to that CSS if the block that has that class is deleted from the saved content?

Or are all block patterns going to be limited to the global styles?

@ryelle ryelle added the [Type] Discussion Proposed idea, needs input from others before actionable label Apr 19, 2021
@StevenDufresne
Copy link
Collaborator

Similar to WordPress/gutenberg#31124

@shaunandrews
Copy link
Collaborator

Right now I'm working under the assumption that block patterns created and submitted to the Pattern Directory will not be able to provide any CSS.

@ryelle
Copy link
Contributor

ryelle commented May 13, 2021

I think that's the right assumption - the only "style" options we should provide are the ones that have block support (global styles). I don't know offhand if there are any theme restrictions here, or how we should best set that up. Could a pattern use a style that a theme doesn't support? Do we need to declare style settings when initializing the editor? — things to think about as the editor is rebuilt here (#59).

@ryelle ryelle moved this to ⚠ On Hold/Blocked in WordPress.org Dec 11, 2024
@ryelle ryelle added [Component] Pattern Creator Anything related to the pattern front end editor or preview and removed [Type] Discussion Proposed idea, needs input from others before actionable labels Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Component] Pattern Creator Anything related to the pattern front end editor or preview
Projects
Status: On Hold/Blocked
Development

No branches or pull requests

4 participants