Skip to content

Global Styles: replace per-control push with a granular "Apply globally" review modal#79719

Closed
annezazu wants to merge 10 commits into
update/global-styles-in-inspector-controlsfrom
update/granular-apply-styles-globally
Closed

Global Styles: replace per-control push with a granular "Apply globally" review modal#79719
annezazu wants to merge 10 commits into
update/global-styles-in-inspector-controlsfrom
update/granular-apply-styles-globally

Conversation

@annezazu

Copy link
Copy Markdown
Contributor

Stacked on #77894 — intended to merge into that branch, not trunk. Addresses the feedback in #49278 (comment).

What & why

In testing #77894, surfacing a per-control "Make default" push on every inspector control felt like too much complexity and risk by default (easy to push something global by accident). This swaps that for a more deliberate, granular flow.

  • Per-control push removed. The local-override dot in inspector labels is now a direct reset control: it shows a reset (−) icon on hover/focus with a "Reset to inherited value" tooltip, and clicking it clears the override (same as the ToolsPanel reset). No more dropdown menu.
  • "Apply globally" is now granular. The block's Advanced → "Apply globally" button opens a review modal listing each changed style with a checkbox (all on by default). Deselect any to ignore, then Apply pushes only the rest to all blocks of that type, with the existing Undo snackbar.

How

  • Disabled the push at its single chokepoint (InheritanceActionsDropdown); the dot becomes a reset button.
  • PushChangesToGlobalStylesControl opens a modal; a describeChange helper renders human-readable labels + values, groups border shorthand, and rides-along the synthetic border-style fallbacks.
  • The per-control push plumbing (use-style-push-handlers, onPushToGlobalStyles props) is left dormant, not removed, to keep this small and reversible while the direction is discussed.

Testing instructions

Use a block theme with Global Styles set (e.g. Twenty Twenty-Four).

  1. Select a Heading with a local style overriding an inherited value → hover the dot → it becomes a − reset icon → click resets the override.
  2. Set a couple of local styles → Advanced → Apply globally → deselect one → Apply → only the kept styles land in Global Styles; Undo reverts.

Notes for review

  • Behavior change: the per-control push's variation-scoped targeting is gone with it; "Apply globally" writes to the block base, as it did before Block Editor: Reflect inherited Global Styles values in block inspector controls #77894.
  • Follow-ups (not done here, to keep the diff focused): rename InheritanceActionsDropdown (no longer a dropdown); optionally remove the dormant push plumbing if this direction is accepted.
  • Unit tests pass locally; the e2e specs were rewritten for the new flow but not run locally (no test env) — relying on CI.

🤖 Generated with Claude Code

aaronrobertshaw and others added 9 commits June 25, 2026 13:53
Add the engine that resolves the Global Styles value a block inherits
(theme.json defaults < theme.json blocks < block style variations),
exposed through InheritedValueProvider / useInheritedValue and the
build-inherited-value resolver. Includes the shared inheritance
indicator component and the supporting private-API surface.
…lues

Wire the block-support hooks (background, border, dimensions, duotone,
typography, and the relocated Elements color host) to compute each
block's inherited Global Styles value via the engine and provide it to
the shared panels through InheritedValueProvider. Background block props
now resolve against the merged inherited background style.
Surface inherited Global Styles values as placeholders and label
indicators on the relocated inspector controls: text colour in the
Typography panel, background colour in the Background panel, and link /
element colours in the Elements panel. Reuses the shared
ColorGradientDropdownItem and InheritanceToolsPanelItem treatments, and
opts the Global Styles screens out of the inspector indicators.
Add a per-control action to push an individual local override up to
Global Styles, wired through the editor settings provider, with unit
coverage for the push handlers and e2e coverage in the post and site
editors.
The site editor 'push individual style' spec saves a user
emptytheme//index template via saveSiteEditorEntities but never
removed it, so the leaked template surfaced as a duplicate 'Index'
card in save-entity-record-template-compat.spec.js (a strict-mode
violation). Delete all wp_templates in beforeEach and afterEach so
the saved template no longer leaks into other specs sharing the DB.
…riations

Rename the local-override "Push to global styles" action to "Make
default", move it below "Reset to inherited value", and add help text
naming the Global Styles location it updates.

The push now writes to the active block style variation's Global Styles
location rather than the block base, so "Make default" updates the
default the user is actually editing. The destination breadcrumb in the
help text is derived from the same context, keeping copy and behaviour in
lockstep. Adds unit coverage for the destination path/help text and an
e2e test for the variation-scoped push.
…treatment

AspectRatioTool rendered its own ToolsPanelItem, so it could not be
wrapped by InheritanceToolsPanelItem like the other dimensions controls.
It only received the inherited label styling, with no inherited tooltip
and no local-override menu.

Render InheritanceToolsPanelItem directly from AspectRatioTool and
forward the inheritance props, and wire the aspect ratio push handler in
the dimensions panel. Aspect ratio now matches the other controls: the
inherited tooltip and the Reset / Make default menu. Consumers that pass
no inheritance props (the generic DimensionsTool) degrade to a plain
ToolsPanelItem, so block-level usage is unchanged.
…ly" modal

Addresses feedback on #77894: surfacing a per-control "push to Global
Styles" action on every inspector control read as too much complexity and
risk by default.

- Disable the per-control "Make default" push. The local-override dot in
  inspector labels is now a direct reset control: it shows a reset icon on
  hover/focus and clears the override on click. The dot is no longer a
  dropdown menu.
- Make the block's Advanced -> "Apply globally" control granular: it now
  opens a review modal listing each changed style with a checkbox, so the
  user can deselect changes to ignore before applying the rest to all
  blocks of the type.
- Leave the per-control push plumbing (use-style-push-handlers,
  onPushToGlobalStyles props) dormant rather than removing it, to keep this
  a small, reversible change while the direction is discussed.
- Update unit tests for the reset-dot, fix the border ride-along filter so a
  user's explicit border-style is not partially applied, and replace the
  push-individual-style e2e specs with Apply-globally modal coverage.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added [Package] Components /packages/components [Package] Editor /packages/editor [Package] Block editor /packages/block-editor labels Jun 30, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@aaronrobertshaw

Copy link
Copy Markdown
Contributor

@annezazu I've split this individual pushing of styles to global styles out into its own standalone feature over in #79839. It takes the suggestion from #49278 (comment) to use DataViews and implements a version of that as well.

If you want to keep experimenting or progressing this branch specifically, feel free to do so. Otherwise, I can close this PR in favor of #79839

@annezazu

annezazu commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

Awesome! Let’s close this out. Thanks for moving this forward.

@annezazu annezazu closed this Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Block editor /packages/block-editor [Package] Components /packages/components [Package] Editor /packages/editor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants