Skip to content

Commit

Permalink
Add backgroundPosition to VALID STYLES.
Browse files Browse the repository at this point in the history
Roll back previous fix, and explicitly set backgroundRepeat to "repeat", because it seems as if it's being overwritten by merging styles (undefined values are stripped)
  • Loading branch information
ramonjd committed May 9, 2024
1 parent ee39e8c commit d124b5b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -346,15 +346,7 @@ function BackgroundSizeToolsPanelItem( {
inheritedValue?.background?.backgroundSize;
const repeatValue =
style?.background?.backgroundRepeat ||
/*
* Edge case where theme.json has a backgroundSize value of 'cover'
* and a backgroundRepeat value. If a user backgroundSize is set,
* ignore the inherited backgroundRepeat value as style?.background?.backgroundRepeat
* is deliberately set to undefined in updateBackgroundSize().
*/
( !! style?.background?.backgroundSize
? undefined
: inheritedValue?.background?.backgroundRepeat );
inheritedValue?.background?.backgroundRepeat;
const imageValue =
style?.background?.backgroundImage?.url ||
inheritedValue?.background?.backgroundImage?.url;
Expand Down Expand Up @@ -447,7 +439,7 @@ function BackgroundSizeToolsPanelItem( {
setImmutably(
style,
[ 'background', 'backgroundRepeat' ],
repeatCheckedValue === true ? 'no-repeat' : undefined
repeatCheckedValue === true ? 'no-repeat' : 'repeat'
)
);

Expand Down
7 changes: 6 additions & 1 deletion packages/blocks/src/api/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,18 @@ export const __EXPERIMENTAL_STYLE_PROPERTY = {
backgroundRepeat: {
value: [ 'background', 'backgroundRepeat' ],
support: [ 'background', 'backgroundRepeat' ],
useEngine: true,
useEngine: false,
},
backgroundSize: {
value: [ 'background', 'backgroundSize' ],
support: [ 'background', 'backgroundSize' ],
useEngine: true,
},
backgroundPosition: {
value: [ 'background', 'backgroundPosition' ],
support: [ 'background', 'backgroundPosition' ],
useEngine: true,
},
borderColor: {
value: [ 'border', 'color' ],
support: [ '__experimentalBorder', 'color' ],
Expand Down

0 comments on commit d124b5b

Please sign in to comment.