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

theme.json spec: use block names for settings & block selectors for styles #29773

Closed
oandregal opened this issue Mar 11, 2021 · 2 comments
Closed
Labels
[Feature] Themes Questions or issues with incorporating or styling blocks in a theme. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json

Comments

@oandregal
Copy link
Member

The current theme.json spec allows theme authors to change settings & styles for specific blocks by addressing them by "block selectors" core/paragraph, core/group, etc.

Some blocks are special in that they represent different HTML markup. An example of this is the Heading block whose name is core/heading. In theme.json, it's addressed by block selectors that represent the different HTML markup combination the block can have: core/heading/h1, core/heading/h2, etc. Themes can't address core/heading, for example.

In practice, these block selectors have proven useful for styles. However, for settings, there has been no use in practice. Which holds the question: does it makes sense that themes can provide settings for different configurations of the same block (the same block with different block attributes)? For example, does it make sense that the heading block can have a different color palette depending on whether it's an H1, H2, etc? This is actually an issue: themes can't provide a specific color palette for the header block, they need to provide the same color palette for all configurations of the block (core/heading/h1, core/heading/h2, etc).

Given this rationale, it seems proper that we do the following:

  • Use "block selectors" for blocks with multiple HTML elements: core/paragraph, core/heading/h1, core/heading/h2, etc. As it is currently.
  • Use block names for settings: core/paragraph, core/heading. Change of behavior for two core blocks: heading & post title. It doesn't look like themes are targeting them on settings.
@oandregal oandregal added the Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json label Mar 11, 2021
@oandregal oandregal mentioned this issue Mar 11, 2021
82 tasks
@carolinan
Copy link
Contributor

carolinan commented Mar 11, 2021

Having to target each heading level individually does feel like it bloats the .json file.
I would not personally change the color, but I can see how one might want to adjust the line height?
I think the number of FSE themes is too low for us to know what theme authors will do 😄 So, I hope they reply.

@oandregal oandregal added the [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. label Mar 11, 2021
This was referenced Mar 16, 2021
@oandregal
Copy link
Member Author

I'm closing this as it is superseded by #29891

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Themes Questions or issues with incorporating or styling blocks in a theme. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json
Projects
None yet
Development

No branches or pull requests

2 participants