Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4766831
add logic for custom color boolean for borders
Oct 15, 2025
999b0ef
add tests to verify color picker is visible or not visible
Oct 16, 2025
db9e443
Merge branch 'WordPress:trunk' into bugfix/respect-custom-color-boole…
n8finch Jun 2, 2026
6a71646
Merge branch 'WordPress:trunk' into bugfix/respect-custom-color-boole…
n8finch Jun 2, 2026
ba662c7
add wrapper for color palette
n8finch Jun 2, 2026
fdbc438
Update packages/components/src/border-box-control/test/index.tsx
n8finch Jun 3, 2026
7d098b5
Update packages/components/src/border-box-control/test/index.tsx
n8finch Jun 3, 2026
6ddfc06
add tests to check that no colors will also disable the color picker
n8finch Jun 3, 2026
ffa793f
update tests to check color guard
n8finch Jun 4, 2026
a04bdd7
remove single use function
n8finch Jun 4, 2026
a539cbd
resolve merge conflicts
n8finch Jun 5, 2026
605653c
remove tests from BorderBoxControl
n8finch Jun 5, 2026
3834cb7
update tests and location
n8finch Jun 5, 2026
dc69078
Merge branch 'trunk' into bugfix/respect-custom-color-boolean-from-th…
n8finch Jun 5, 2026
f57c190
remove custom prop
n8finch Jun 5, 2026
3346ca9
lint files
n8finch Jun 8, 2026
83afdd5
update check to return null Vstack
n8finch Jun 8, 2026
f0685e8
Merge branch 'WordPress:trunk' into bugfix/respect-custom-color-boole…
n8finch Jun 8, 2026
3e2e58b
update changelog
n8finch Jun 8, 2026
6bcb5db
Update packages/components/CHANGELOG.md
n8finch Jun 9, 2026
a01c105
Update packages/components/src/color-palette/index.tsx
n8finch Jun 9, 2026
e68122d
update tests to ColorPalette
n8finch Jun 9, 2026
df660f4
update merge conflicts
n8finch Jun 9, 2026
6265565
Update packages/components/src/color-palette/index.tsx
n8finch Jun 9, 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
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export default function BorderPanel( {
defaultControls = DEFAULT_CONTROLS,
} ) {
const colors = useColorsPerOrigin( settings );
const areCustomSolidsEnabled = settings?.color?.custom;
Comment thread
aaronrobertshaw marked this conversation as resolved.
const decodeValue = useCallback(
( rawValue ) => getValueFromVariable( { settings }, '', rawValue ),
[ settings ]
Expand Down Expand Up @@ -270,6 +271,7 @@ export default function BorderPanel( {
>
<BorderBoxControl
colors={ colors }
disableCustomColors={ ! areCustomSolidsEnabled }
enableAlpha
enableStyle={ showBorderStyle }
onChange={ onBorderChange }
Expand Down
4 changes: 4 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

- `Tooltip`: Use `--wpds-border-radius-md` for portaled popup surfaces, aligning with menus and popovers ([#78983](https://github.com/WordPress/gutenberg/pull/78983)).

### Bug Fixes

- `ColorPalette`: Avoid rendering an empty palette when custom colors are disabled and no color presets are available ([#72402](https://github.com/WordPress/gutenberg/pull/72402)).

### Internal

- `UnitControl`: Remove dead native code branches now that `Platform.OS` is always `'web'` following the React Native removal ([#79031](https://github.com/WordPress/gutenberg/pull/79031)).
Expand Down
5 changes: 5 additions & 0 deletions packages/components/src/color-palette/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,11 @@ function UnforwardedColorPalette(
ariaLabelledby
);

// If disableCustomColors is true and colors.length is 0, return null to avoid rendering an empty palette wrapper.
if ( disableCustomColors && colors.length === 0 && ! actions ) {
return null;
}

return (
<VStack spacing={ 3 } ref={ forwardedRef } { ...additionalProps }>
{ ! disableCustomColors && (
Expand Down
30 changes: 30 additions & 0 deletions packages/components/src/color-palette/test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,20 @@ describe( 'ColorPalette', () => {
).not.toBeInTheDocument();
} );

it( 'should render nothing when custom colors are disabled, there are no colors, and it is not clearable', () => {
const onChange = jest.fn();
const { container } = render(
<ColorPalette
colors={ [] }
disableCustomColors
clearable={ false }
onChange={ onChange }
/>
);

expect( container ).toBeEmptyDOMElement();
} );

it( 'should render dropdown and its content', async () => {
const user = userEvent.setup();
const onChange = jest.fn();
Expand Down Expand Up @@ -217,6 +231,22 @@ describe( 'ColorPalette', () => {
).toBeInTheDocument();
} );

it( 'should still show the clear button when colors is empty and custom colors are disabled', () => {
const onChange = jest.fn();

render(
<ColorPalette
colors={ [] }
disableCustomColors
onChange={ onChange }
/>
);

expect(
screen.getByRole( 'button', { name: 'Clear' } )
).toBeInTheDocument();
} );

it( 'should display the selected color name and value', async () => {
const user = userEvent.setup();

Expand Down
Loading