Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
d7ef134
Block editor: reflect inherited Global Styles values in the inspector
aaronrobertshaw Jun 29, 2026
ccb9334
Block editor: extract shared useRawGlobalStyles helper
aaronrobertshaw Jun 29, 2026
03f9da1
Block editor: remove dead inherited-value builders and simplify the API
aaronrobertshaw Jun 30, 2026
9fb3d18
Block editor: tighten inherited-value panel tests
aaronrobertshaw Jun 30, 2026
71aec4c
Block editor: trim verbose comments in the inherited-value builder
aaronrobertshaw Jun 30, 2026
6694b10
Block editor: remove the unused element-fold axis from the inherited-…
aaronrobertshaw Jun 30, 2026
acd335e
Block editor: fix inherited Global Styles label affordances and backg…
aaronrobertshaw Jul 3, 2026
b940c68
Block editor: remove portal approach for inherited Global Styles ador…
aaronrobertshaw Jul 3, 2026
995cb23
Block editor: render inherited values as control values
aaronrobertshaw Jul 7, 2026
e8b7274
Block editor: refine inherited-value reset affordances
aaronrobertshaw Jul 7, 2026
4ea1b47
Block editor: remove inaccurate inherited Global Styles docs and trim…
aaronrobertshaw Jul 8, 2026
faa1d6c
Block editor: suppress root-sourced non-cascading values in inherited…
aaronrobertshaw Jul 8, 2026
7028a1f
Block editor: trim inherited-value root-source tests to the essential…
aaronrobertshaw Jul 8, 2026
2dd9680
Block editor: rename internal test-only export from __unstable to pri…
aaronrobertshaw Jul 8, 2026
7351112
Block editor: condense duplicated inherited-value bridge JSDoc to a o…
aaronrobertshaw Jul 8, 2026
957a885
Block editor: correct stale label comments and drop redundant null guard
aaronrobertshaw Jul 8, 2026
ebef075
Block editor: cover the input-control label class in inherited-value …
aaronrobertshaw Jul 8, 2026
10827de
Block editor: stop baking inherited border into local override when s…
aaronrobertshaw Jul 8, 2026
615c8c9
Block editor: show inherited underline and position the override dot …
aaronrobertshaw Jul 8, 2026
e318fe7
Block editor: centralise inherited Global Styles resolution in the bu…
aaronrobertshaw Jul 8, 2026
131097c
Block editor: collapse inherited-value Provider into a single hook
aaronrobertshaw Jul 9, 2026
cc09e36
Block editor: test cleanup for inherited Global Styles panels
aaronrobertshaw Jul 9, 2026
3e3a5a3
Block editor: drop premature inheritedSources plumbing from inspector…
aaronrobertshaw Jul 9, 2026
2056e9e
Global styles: rename inherited-value builder to resolveStyles/useRes…
aaronrobertshaw Jul 10, 2026
57e0928
Block editor: fold root element styles into inherited value for eleme…
aaronrobertshaw Jul 13, 2026
cd3b0e0
Block editor: rename build-inherited-value module to resolve-styles
aaronrobertshaw Jul 13, 2026
83e8a65
Block editor: restore Border label in Global Styles when a Shadow con…
aaronrobertshaw Jul 13, 2026
5a64e0c
Block editor: restore line-height 1.5 default placeholder when nothin…
aaronrobertshaw Jul 13, 2026
fc09246
Block editor: fix duplicated unit on inherited Layout content/wide width
aaronrobertshaw Jul 13, 2026
896d056
Block editor: clear inherited swatch selection when a local colour is…
aaronrobertshaw Jul 13, 2026
5d95f04
Block editor: treat backgroundImage as atomic in resolve-styles merge
aaronrobertshaw Jul 13, 2026
9b04de0
Block editor: skip refs that resolve to another ref in resolve-styles…
aaronrobertshaw Jul 13, 2026
3c73507
Block editor: share one cascade merge across inherited-value consumers
aaronrobertshaw Jul 13, 2026
7eeae7d
Block editor: update panel tests for restored inherited-value display
aaronrobertshaw Jul 13, 2026
649a7e8
Clean up resolved style sources
aaronrobertshaw Jul 14, 2026
df5bcf4
Block editor: skip local-override dot toggle offset when no spacing t…
aaronrobertshaw Jul 15, 2026
34b042b
Block editor: vertically center local-override reset dot on the label…
aaronrobertshaw Jul 15, 2026
fcd43a6
Fix Button block e2e regressions from global styles in inspector cont…
aaronrobertshaw Jul 15, 2026
487f61a
Global styles engine: relocate resolveStyle and variation resolver
aaronrobertshaw Jul 16, 2026
52eaf9e
Global styles engine: drop low-value inline comments
aaronrobertshaw Jul 16, 2026
191d2ab
Global styles engine: key resolveStyle memo on _links
aaronrobertshaw Jul 16, 2026
490bf49
Border radius control: drop unused className and placeholder props
aaronrobertshaw Jul 16, 2026
558d2b3
Global styles panels: preserve layout className when inheritance indi…
aaronrobertshaw Jul 16, 2026
6828045
Global styles engine: rename getVariationStylesWithRefValues to getVa…
aaronrobertshaw Jul 17, 2026
e5db4ed
Global styles engine: reshape resolveStyle signature (globalStyles fi…
aaronrobertshaw Jul 17, 2026
b08d065
Typography panel: preserve a deliberately-set link color on text colo…
aaronrobertshaw Jul 17, 2026
c469b06
changelog: add enhancement for inspector controls reflecting inherite…
ramonjd Jul 20, 2026
8cb4172
Merge branch 'trunk' into update/global-styles-in-inspector-controls
t-hamano Jul 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/block-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Enhancements

- Inspector controls in the standard block-supports panels (Typography, Dimensions, Border, Color, Background, Filters) now reflect the value a block inherits from Global Styles when no local override is set. Inherited controls show that value at rest (as a placeholder, preselected option, or resolved value) and mark the label with a dotted underline; setting a local override reveals a reset affordance that clears the override back to the inherited value ([#77894](https://github.com/WordPress/gutenberg/pull/77894)).

## 16.0.0 (2026-07-14)

### Internal
Expand Down
2 changes: 2 additions & 0 deletions packages/block-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,8 @@ _Parameters_
- _props.label_ `?string`: A label for the control.
- _props.onChange_ `( value: string ) => void`: Called when the dimension value changes.
- _props.value_ `string`: The current dimension value.
- _props.placeholder_ `?string`: Placeholder text for the custom-value input.
- _props.className_ `?string`: Additional CSS class on the wrapping fieldset.
- _props.dimensionSizes_ `?Object`: Optional dimension size presets. Falls back to settings from the store.

_Returns_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { getResolvedValue } from '@wordpress/global-styles-engine';
* Internal dependencies
*/
import { hasBackgroundImageValue } from '../global-styles/background-panel';
import { InheritanceResetButton } from '../global-styles/inheritance';
import { setImmutably } from '../../utils/object';
import MediaReplaceFlow from '../media-replace-flow';
import { store as blockEditorStore } from '../../store';
Expand Down Expand Up @@ -193,6 +194,7 @@ function BackgroundControlsPanel( {
onToggle: onToggleCallback = noop,
hasImageValue,
onReset,
hasLocalOverride,
containerRef,
} ) {
if ( ! hasImageValue ) {
Expand Down Expand Up @@ -225,24 +227,38 @@ function BackgroundControlsPanel( {
as="button"
onToggleCallback={ onToggleCallback }
/>
{ onReset && (
<Button
__next40pxDefaultSize
label={ __( 'Reset' ) }
className="block-editor-global-styles-background-panel__reset"
size="small"
icon={ resetIcon }
onClick={ () => {
onReset();
// Close the dropdown if open.
if ( isOpen ) {
onToggle();
}
// Focus the toggle button.
focusToggleButton( containerRef );
} }
/>
) }
{ onReset &&
( hasLocalOverride ? (
<InheritanceResetButton
className="block-editor-global-styles-background-panel__reset"
onResetToInherited={ () => {
onReset();
// Close the dropdown if open.
if ( isOpen ) {
onToggle();
}
// Focus the toggle button.
focusToggleButton( containerRef );
} }
/>
) : (
<Button
__next40pxDefaultSize
label={ __( 'Reset' ) }
className="block-editor-global-styles-background-panel__reset"
size="small"
icon={ resetIcon }
onClick={ () => {
onReset();
// Close the dropdown if open.
if ( isOpen ) {
onToggle();
}
// Focus the toggle button.
focusToggleButton( containerRef );
} }
/>
) ) }
</>
);
} }
Expand Down Expand Up @@ -434,22 +450,29 @@ function BackgroundSizeControls( {
inheritedValue,
defaultValues,
} ) {
const sizeValue =
style?.background?.backgroundSize ||
inheritedValue?.background?.backgroundSize;
const repeatValue =
style?.background?.backgroundRepeat ||
inheritedValue?.background?.backgroundRepeat;
/*
* Read local and inherited values separately so each sub-control can
* show the inherited value while marking the control as inherited.
*/
const localSizeValue = style?.background?.backgroundSize;
const localRepeatValue = style?.background?.backgroundRepeat;
const localPositionValue = style?.background?.backgroundPosition;
const localAttachmentValue = style?.background?.backgroundAttachment;
const inheritedSizeValue = inheritedValue?.background?.backgroundSize;
const inheritedRepeatValue = inheritedValue?.background?.backgroundRepeat;
const inheritedPositionValue =
inheritedValue?.background?.backgroundPosition;
const inheritedAttachmentValue =
inheritedValue?.background?.backgroundAttachment;

const sizeValue = localSizeValue || inheritedSizeValue;
const repeatValue = localRepeatValue || inheritedRepeatValue;
const imageValue =
style?.background?.backgroundImage?.url ||
inheritedValue?.background?.backgroundImage?.url;
const isUploadedImage = style?.background?.backgroundImage?.id;
const positionValue =
style?.background?.backgroundPosition ||
inheritedValue?.background?.backgroundPosition;
const attachmentValue =
style?.background?.backgroundAttachment ||
inheritedValue?.background?.backgroundAttachment;
const positionValue = localPositionValue || inheritedPositionValue;
const attachmentValue = localAttachmentValue || inheritedAttachmentValue;

/*
* Set default values for uploaded images.
Expand Down Expand Up @@ -642,12 +665,10 @@ export default function BackgroundImagePanel( {
inheritedValue = value,
settings,
defaultValues = {},
showInheritanceLabelIndicators = true,
} ) {
/*
* Resolve any inherited "ref" pointers.
* Should the block editor need resolved, inherited values
* across all controls, this could be abstracted into a hook,
* e.g., useResolveGlobalStyle
* Resolve inherited `ref` pointers for background controls.
*/
const { globalStyles, _links } = useSelect( ( select ) => {
const { getSettings } = select( blockEditorStore );
Expand Down Expand Up @@ -681,13 +702,25 @@ export default function BackgroundImagePanel( {
}, [ globalStyles, _links, inheritedValue ] );

const resetBackground = () =>
onChange( setImmutably( value, [ 'background' ], {} ) );
onChange(
setImmutably( value, [ 'background' ], {
gradient: value?.background?.gradient,
} )
);

const { title, url } = value?.background?.backgroundImage || {
...resolvedInheritedValue?.background?.backgroundImage,
};
const localHasImageValue = hasBackgroundImageValue( value );
const hasImageValue =
hasBackgroundImageValue( value ) ||
localHasImageValue || hasBackgroundImageValue( resolvedInheritedValue );
// The blue-dot local-override affordance is part of the inherited-value
// treatment. When that treatment is disabled (e.g. in the Global Styles
// panel, where the edited value *is* the global style rather than a local
// override of it), fall back to the plain reset control.
const hasLocalOverride =
showInheritanceLabelIndicators &&
localHasImageValue &&
hasBackgroundImageValue( resolvedInheritedValue );

const imageValue =
Expand Down Expand Up @@ -721,7 +754,8 @@ export default function BackgroundImagePanel( {
url={ url }
onToggle={ setIsDropDownOpen }
hasImageValue={ hasImageValue }
onReset={ resetBackground }
hasLocalOverride={ hasLocalOverride }
onReset={ localHasImageValue ? resetBackground : undefined }
containerRef={ containerRef }
>
<VStack spacing={ 3 } className="single-column">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,25 @@
transition: opacity 0.1s ease-in-out;
}

&.has-local-override-from-global-styles__reset {
position: absolute;
display: inline-flex;
align-items: center;
justify-content: center;
top: 50%;
transform: translateY(-50%);
margin-block: 0;
margin-inline: 0 $grid-unit;
opacity: 1;
}

&.block-editor-global-styles-background-panel__reset {
border-radius: $radius-small;
}

.block-editor-global-styles-background-panel__dropdown-toggle:hover + &,
&:focus,
&:focus-within,
&:hover {
opacity: 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { useDispatch, useSelect } from '@wordpress/data';
import { privateApis as globalStylesEnginePrivateApis } from '@wordpress/global-styles-engine';

/**
* Internal dependencies
Expand All @@ -18,7 +19,9 @@ import useStylesForBlocks from '../block-styles/use-styles-for-block';
import { replaceActiveStyle } from '../block-styles/utils';
import { store as blockEditorStore } from '../../store';
import { globalStylesDataKey } from '../../store/private-keys';
import { getVariationStylesWithRefValues } from '../../hooks/block-style-variation';
import { unlock } from '../../lock-unlock';

const { getVariationStyle } = unlock( globalStylesEnginePrivateApis );

const styleIcon = (
<SVG
Expand Down Expand Up @@ -59,7 +62,7 @@ function SwitchSectionStyle( { clientId } ) {

// Get the background color for the active style
const activeStyleBackground = activeStyle?.name
? getVariationStylesWithRefValues(
? getVariationStyle(
{
settings: globalSettings,
styles: globalStyles,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* External dependencies
*/
import clsx from 'clsx';

/**
* WordPress dependencies
*/
Expand Down Expand Up @@ -58,6 +63,8 @@ function useDimensionSizes( presets ) {
* @param {?string} props.label A label for the control.
* @param {( value: string ) => void } props.onChange Called when the dimension value changes.
* @param {string} props.value The current dimension value.
* @param {?string} props.placeholder Placeholder text for the custom-value input.
* @param {?string} props.className Additional CSS class on the wrapping fieldset.
* @param {?Object} props.dimensionSizes Optional dimension size presets. Falls back to settings from the store.
*
* @return {Component} The component to be rendered.
Expand All @@ -66,6 +73,8 @@ export default function DimensionControl( {
label = __( 'Dimension' ),
onChange,
value,
placeholder,
className,
dimensionSizes: dimensionSizesProp,
} ) {
const [ dimensionSizesFromSettings, availableUnits ] = useSettings(
Expand Down Expand Up @@ -146,7 +155,9 @@ export default function DimensionControl( {
};

return (
<fieldset className="block-editor-dimension-control">
<fieldset
className={ clsx( 'block-editor-dimension-control', className ) }
>
<BaseControl.VisualLabel as="legend">
{ label }
</BaseControl.VisualLabel>
Expand All @@ -157,6 +168,7 @@ export default function DimensionControl( {
minimumCustomValue={ 0 }
onChange={ onChange }
onUnitChange={ handleUnitChange }
placeholder={ placeholder }
presets={ options }
presetType="dimension"
selectedUnit={ selectedUnit }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
/**
* WordPress dependencies
*/
import {
SelectControl,
__experimentalToolsPanelItem as ToolsPanelItem,
} from '@wordpress/components';
import { SelectControl } from '@wordpress/components';
import { __, _x } from '@wordpress/i18n';
/**
* Internal dependencies
*/
import { useSettings } from '../use-settings';
import { InheritanceToolsPanelItem } from '../global-styles/inheritance';

/**
* @typedef {import('@wordpress/components/build-types/select-control/types').SelectControlProps} SelectControlProps
Expand All @@ -29,6 +27,9 @@ import { useSettings } from '../use-settings';
* @property {SelectControlProps[]} [options] Aspect ratio options.
* @property {string} [defaultValue] Default aspect ratio value.
* @property {boolean} [isShownByDefault] Whether the tool is shown by default.
* @property {string} [className] Additional CSS class on the wrapping panel item.
* @property {boolean} [isInherited] Whether the control is displaying an inherited Global Styles value.
* @property {boolean} [hasLocalOverride] Whether a local value is overriding an inherited Global Styles value.
*/

export default function AspectRatioTool( {
Expand All @@ -39,6 +40,9 @@ export default function AspectRatioTool( {
defaultValue = 'auto',
hasValue,
isShownByDefault = true,
className,
isInherited,
hasLocalOverride,
} ) {
// Match the CSS default so if the value is used directly in CSS it will look correct in the control.
const displayValue = value ?? 'auto';
Expand Down Expand Up @@ -78,7 +82,10 @@ export default function AspectRatioTool( {
];

return (
<ToolsPanelItem
<InheritanceToolsPanelItem
className={ className }
isInherited={ isInherited }
hasLocalOverride={ hasLocalOverride }
hasValue={
hasValue ? hasValue : () => displayValue !== defaultValue
}
Expand All @@ -93,6 +100,6 @@ export default function AspectRatioTool( {
options={ options ?? aspectRatioOptions }
onChange={ onChange }
/>
</ToolsPanelItem>
</InheritanceToolsPanelItem>
);
}
Loading
Loading