-
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
theme.json: whether or not to allow targetting settings
that are specific to the block
#35114
Comments
settings
that are specific to the block
I understand how this is appealing and why themes would want to use The major drawback I see is that we lose the ability for blocks to inherit global settings
Anyway, if the appetite for having something like this is very strong, I feel the first step is to look at how blocks, whether they come from core or any third-party, can declare what attributes/supports/settings they want to expose via |
For awareness, @jorgefilipecosta @youknowriad @mtias @getdave @talldan @draganescu |
settings
that are specific to the blocksettings
that are specific to the block
I think one requirement should be that all blocks must require a default and assume no setting from theme.json. This way themes wouldn't be required to do anything unless they want to override the defaults. I can see this useful for my code-syntax-block. It has a setting for specifying a color scheme and/or stylesheet to use for the code colors. It would be nice to allow for something like: {
"settings": {
"mkaz/code-syntax-block": {
"colorScheme": "a11y-dark"
}
}
} |
Also discussed at #34908 |
I have heard from many theme developers that have been confused about why theme.json does not add support for the editor control, when the setting is enabled. |
I've been thinking about this a fair bit and have even done a very basic exploration in #34784. From the perspective of the Nav block, some Themes may not want to allow for complex navigations to be created as they have not added support for this or their Theme isn't well suited. In which case, you'd need a way to enable/disable various features of the block (or, depending on how the block is coded, one blanket "switch") without having to jump through several hoops (filters, hooks...etc). Theme JSON seems like a logical choice for this - a declarative API. I agree with what @mkaz suggests. When the block exposes settings that should be configurable via Theme JSON they should also have to declare a default. Therefore, Themes won't need to play catch up as they will receive the default and would only need to update their If this API came into being, we could encourage block developers to supply the existing default for any setting they expose to avoid backward compatibility issues. |
That experiment was great to consolidate some of my thoughts about this. Thanks for pushing it. One of the points I've brought up in that exploration (see) was that we'd need to start by thinking how any block (core or third-party) can register custom settings. The other thought I shared was that it'd be beneficial to think how many of those custom settings can be thought of as block supports, actually:
|
@carolinan would you mind sharing specific examples when you find them? That'd be very helpful to weigh on this and understand what's the best fit. |
I do agree we should look ti normalise settings where possible. I wonder however, if this will sometimesl catch us out. We're trying to force things like Many blocks at the moment control their configuration via attributes. Perhaps there is some interplay between Theme JSON and attributes we could explore? |
The "Social Icons" block is a good example - the settings for the block relate to how it displays so you would expect them to be settable by theme.json, but currently that's not possible. |
Since examples are needed, I’m just adding my question to @carolinan on Twitter here: “Is it the objective to be able to configure every option in core blocks through theme.json? discussion: https://twitter.com/dqipijnenburg/status/1450905514980921350?s=21 |
A few years have passed since this one has been created. I don't think it is actionable or reflects the reality and needs of the project right now, so I'm closing. |
Many people have expressed that it'd be convenient to allow themes to configure settings that are block-specific via
theme.json
. While block attributes & supports are configurable via the existing block filters,theme.json
settings have proven very ergonomic for themes, hence the appetite to have more of it.We've discussed or touched this topic across different PRs & issues, and I figured it'd be good to have a single place to share and discuss.
The text was updated successfully, but these errors were encountered: