diff --git a/packages/block-editor/src/hooks/background.js b/packages/block-editor/src/hooks/background.js index 3d648e1928c6e..67373ecd0516c 100644 --- a/packages/block-editor/src/hooks/background.js +++ b/packages/block-editor/src/hooks/background.js @@ -409,7 +409,19 @@ function BackgroundSizePanelItem( { const updateBackgroundSize = ( next ) => { // When switching to 'contain' toggle the repeat off. - const nextRepeat = next === 'contain' ? 'no-repeat' : undefined; + let nextRepeat = repeatValue; + + if ( next === 'contain' ) { + nextRepeat = 'no-repeat'; + } + + if ( + ( currentValueForToggle === 'cover' || + currentValueForToggle === 'contain' ) && + next === 'auto' + ) { + nextRepeat = undefined; + } setAttributes( { style: cleanEmptyObject( { @@ -482,12 +494,14 @@ function BackgroundSizePanelItem( { value={ sizeValue } /> ) : null } - + { currentValueForToggle !== 'cover' && ( + + ) } ); }