diff --git a/packages/edit-site/src/components/global-styles/gradients-palette-panel.js b/packages/edit-site/src/components/global-styles/gradients-palette-panel.js index 747534993c5933..4c791b8e6b0117 100644 --- a/packages/edit-site/src/components/global-styles/gradients-palette-panel.js +++ b/packages/edit-site/src/components/global-styles/gradients-palette-panel.js @@ -1,6 +1,7 @@ /** * WordPress dependencies */ +import { useViewportMatch } from '@wordpress/compose'; import { __experimentalVStack as VStack, __experimentalPaletteEdit as PaletteEdit, @@ -17,6 +18,7 @@ import Subtitle from './subtitle'; import { unlock } from '../../private-apis'; const { useGlobalSetting } = unlock( blockEditorPrivateApis ); +const mobilePopoverProps = { placement: 'bottom-start', offset: 8 }; const noop = () => {}; @@ -63,6 +65,9 @@ export default function GradientPalettePanel( { name } ) { ...( defaultDuotone && defaultDuotoneEnabled ? defaultDuotone : [] ), ]; + const isMobileViewport = useViewportMatch( 'small', '<' ); + const popoverProps = isMobileViewport ? mobilePopoverProps : undefined; + return ( ) } { !! defaultGradients && @@ -88,6 +94,7 @@ export default function GradientPalettePanel( { name } ) { onChange={ setDefaultGradients } paletteLabel={ __( 'Default' ) } paletteLabelLevel={ 3 } + popoverProps={ popoverProps } /> ) } { !! duotonePalette && !! duotonePalette.length && (