Global Styles: replace per-control push with a granular "Apply globally" review modal#79719
Closed
annezazu wants to merge 10 commits into
Closed
Conversation
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>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
b501bf5 to
721a479
Compare
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 |
Contributor
Author
|
Awesome! Let’s close this out. Thanks for moving this forward. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
How
InheritanceActionsDropdown); the dot becomes a reset button.PushChangesToGlobalStylesControlopens a modal; adescribeChangehelper renders human-readable labels + values, groups border shorthand, and rides-along the synthetic border-style fallbacks.use-style-push-handlers,onPushToGlobalStylesprops) 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).
Notes for review
InheritanceActionsDropdown(no longer a dropdown); optionally remove the dormant push plumbing if this direction is accepted.🤖 Generated with Claude Code