Skip to content

Commit 3d08227

Browse files
authored
fix: column gap inherited from desktop collapses tablet columns (#2045)
1 parent 9386e73 commit 3d08227

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/block-components/column/style.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ const getStyleParams = ( options = {} ) => {
4343
format: '%s%',
4444
dependencies: [ 'columnAdjacentCount' ],
4545
valueCallback: ( value, getAttribute, device ) => {
46-
if ( device === 'desktop' ) {
47-
return value
48-
}
4946
const adjacentCount = getAttribute( 'columnAdjacentCount', device )
5047
if ( adjacentCount ) {
5148
return value.replace( /([\d\.]+%)$/, `calc($1 - var(--stk-column-gap, 0px) * ${ adjacentCount - 1 } / ${ adjacentCount } )` )
@@ -73,10 +70,6 @@ const getStyleParams = ( options = {} ) => {
7370
// No need to do this in the editor since it already does this.
7471
const value = device === 'desktop' ? _value : _value.replace( /^1 1/, '0 1' )
7572

76-
if ( device === 'desktop' ) {
77-
return value
78-
}
79-
8073
const adjacentCount = getAttribute( 'columnAdjacentCount', device )
8174
if ( adjacentCount ) {
8275
return value.replace( /([\d\.]+%)$/, `calc($1 - var(--stk-column-gap, 0px) * ${ adjacentCount - 1 } / ${ adjacentCount } )` )

src/block-components/column/use-column.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ export const useColumn = () => {
2121
if ( adjacentBlocks.length ) {
2222
widths.forEach( ( width, i ) => {
2323
// TODO: When Gutenberg 10.1 comes out, update this to just one updateBlockAttributes call for all client Ids
24-
updateBlockAttributes( adjacentBlocks[ i ].clientId, { columnWidth: width } )
24+
updateBlockAttributes( adjacentBlocks[ i ].clientId, {
25+
columnWidth: width,
26+
columnAdjacentCount: widths.length,
27+
} )
2528
} )
2629
}
2730
},

0 commit comments

Comments
 (0)