Opened 4 weeks ago
#8012 new defect (bug)
Incorrect use of "elements" instead of "blocks" in Theme Handbook example for nested element styles
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | low | |
Component: | Handbooks | Keywords: | |
Cc: |
Description
Issue Description
The Theme Handbook page on applying styles in theme.json contains an incorrect example under the “Styling elements nested in blocks” section. The example uses "elements" as the top-level key where it should be "blocks" when targeting specific core blocks like core/pullquote
.
URL of the Page with the Issue
Why is this a problem?
This typo can confuse theme developers trying to target nested elements inside blocks. Using "elements" as the top-level key in this context is invalid and will not apply any styles, potentially leading to wasted debugging time and incorrect assumptions about how theme.json works.
Suggested Fix
Update the example by replacing the top-level "elements" key with "blocks", as shown below:
{ "version": 2, "styles": { "blocks": { "core/pullquote": { "typography": { "fontSize": "2.25rem" }, "elements": { "cite": { "typography": { "fontSize": "max( 50%, 1.5rem )" } } } } } } }
Also consider updating the example to use version 3 of the schema for consistency with current standards.