-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Block styles: reflect inherited global styles values in block appearance controls #64670
Copy link
Copy link
Closed
Closed
Copy link
Labels
Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Feature] Design ToolsTools that impact the appearance of blocks both to expand the number of tools and improve the experiTools that impact the appearance of blocks both to expand the number of tools and improve the experi[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Metadata
Metadata
Assignees
Labels
Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.jsonAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Feature] Design ToolsTools that impact the appearance of blocks both to expand the number of tools and improve the experiTools that impact the appearance of blocks both to expand the number of tools and improve the experi[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Type
Fields
Give feedbackNo fields configured for issues without a type.
The tracking issue logs tasks associated primarily with the following issue:
Blocks can "inherit" styles from theme.json and user global styles. These styles are loaded into the Block Editor as global styles CSS, meaning that block will display its inherited styles in the editor canvas.
A block's design tool controls however only reflect applied block-level styles and not any global styles values.
Consequently, even though a block may appear to have, for example, red text in the Block Editor canvas (assuming that style is defined in theme.json), the block's color controls will feature empty values.
To avoid confusion to users, a block's style controls should reflect, as much as possible, the styles that a block inherits.
Constraints
The tracking issue is deliberately limited in scope to displaying values from the merged theme.json/global styles object.
Enqueued stylesheets and theme.json custom CSS for example will affect a block's appearance in the editor canvas but they cannot be reliably parsed. Similarly, other styles inherited via the CSS cascade such as a parent block's inner element styles, or a parent with block style variation applied's inner block type styles, would likely require querying the browser element itself.
A possible "Phase 2" could be to test the performance of extracting values using
getComputedStyle().Tasks (WIP)
Root Global > Root Element > Block > Block Element > Block style variations. See: Styles: show a hierarchy of styles clearly (theme, user, global unspecific, global specific, local, etc) #49278"ref"pointers or relative paths are resolved. E.g., see this comment.A corollary, and follow-up issue, is to enable "unsetting" global styles at the block level:
Related