diff --git a/packages/block-editor/src/components/global-styles/color-panel.js b/packages/block-editor/src/components/global-styles/color-panel.js
index 3b55ec36fc91db..99a5519e9dd008 100644
--- a/packages/block-editor/src/components/global-styles/color-panel.js
+++ b/packages/block-editor/src/components/global-styles/color-panel.js
@@ -12,12 +12,12 @@ import {
__experimentalHStack as HStack,
__experimentalZStack as ZStack,
__experimentalDropdownContentWrapper as DropdownContentWrapper,
- TabPanel,
ColorIndicator,
Flex,
FlexItem,
Dropdown,
Button,
+ privateApis as componentsPrivateApis,
} from '@wordpress/components';
import { useCallback } from '@wordpress/element';
import { __, sprintf } from '@wordpress/i18n';
@@ -29,6 +29,7 @@ import ColorGradientControl from '../colors-gradients/control';
import { useColorsPerOrigin, useGradientsPerOrigin } from './hooks';
import { getValueFromVariable } from './utils';
import { setImmutably } from '../../utils/object';
+import { unlock } from '../../lock-unlock';
export function useHasColorPanel( settings ) {
const hasTextPanel = useHasTextPanel( settings );
@@ -203,12 +204,11 @@ function ColorPanelDropdown( {
colorGradientControlSettings,
panelId,
} ) {
- const tabConfigs = tabs.map( ( { key, label: tabLabel } ) => {
- return {
- name: key,
- title: tabLabel,
- };
- } );
+ const currentTab = tabs.find( ( tab ) => tab.userValue !== undefined );
+ // Unlocking `Tabs` too early causes the `unlock` method to receive an empty
+ // object, due to circular dependencies.
+ // See https://github.com/WordPress/gutenberg/issues/52692
+ const { Tabs } = unlock( componentsPrivateApis );
return (
) }
{ tabs.length > 1 && (
-
- { ( tab ) => {
- const selectedTab = tabs.find(
- ( t ) => t.key === tab.name
- );
-
- if ( ! selectedTab ) {
- return null;
- }
-
+
+
+ { tabs.map( ( tab ) => (
+
+ { tab.label }
+
+ ) ) }
+
+
+ { tabs.map( ( tab ) => {
return (
-
+
+
+
);
- } }
-
+ } ) }
+
) }