Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try removing default align-items styles from flex layout #47099

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions lib/block-supports/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,6 @@ function gutenberg_get_layout_style( $selector, $layout, $has_block_gap_support
'selector' => $selector,
'declarations' => array( 'align-items' => $justify_content_options[ $layout['justifyContent'] ] ),
);
} else {
$layout_styles[] = array(
'selector' => $selector,
'declarations' => array( 'align-items' => 'flex-start' ),
);
}
if ( ! empty( $layout['verticalAlignment'] ) && array_key_exists( $layout['verticalAlignment'], $vertical_alignment_options ) ) {
$layout_styles[] = array(
Expand Down
3 changes: 1 addition & 2 deletions lib/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,7 @@
{
"selector": "",
"rules": {
"flex-wrap": "wrap",
"align-items": "center"
"flex-wrap": "wrap"
}
},
{
Expand Down
19 changes: 9 additions & 10 deletions packages/block-editor/src/layouts/flex.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ export default {
: 'wrap';
const verticalAlignment =
verticalAlignmentMap[ layout.verticalAlignment ];
const alignItems =
alignItemsMap[ layout.justifyContent ] || alignItemsMap.left;
const alignItems = alignItemsMap[ layout.justifyContent ];

let output = '';
const rules = [];
Expand All @@ -160,7 +159,9 @@ export default {
rules.push( `justify-content: ${ verticalAlignment }` );
}
rules.push( 'flex-direction: column' );
rules.push( `align-items: ${ alignItems }` );
if ( alignItems ) {
rules.push( `align-items: ${ alignItems }` );
}
}

if ( rules.length ) {
Expand Down Expand Up @@ -196,12 +197,7 @@ function FlexLayoutVerticalAlignmentControl( {
} ) {
const { orientation = 'horizontal' } = layout;

const defaultVerticalAlignment =
orientation === 'horizontal'
? verticalAlignmentMap.center
: verticalAlignmentMap.top;

const { verticalAlignment = defaultVerticalAlignment } = layout;
const { verticalAlignment = 'top' } = layout;

const onVerticalAlignmentChange = ( value ) => {
onChange( {
Expand Down Expand Up @@ -263,7 +259,10 @@ function FlexLayoutJustifyContentControl( {
onChange,
isToolbar = false,
} ) {
const { justifyContent = 'left', orientation = 'horizontal' } = layout;
const { orientation = 'horizontal' } = layout;
const defaultJustification =
orientation === 'horizontal' ? 'left' : 'stretch';
const { justifyContent = defaultJustification } = layout;
const onJustificationChange = ( value ) => {
onChange( {
...layout,
Expand Down
5 changes: 0 additions & 5 deletions packages/block-library/src/gallery/style.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
// Import styles for rendering the static content of deprecated gallery versions.
@import "./deprecated.scss";

// The following is a temporary override until flex layout supports
// an align items setting of normal.
figure.wp-block-gallery.has-nested-images {
align-items: normal;
}
// Styles for current version of gallery block.
.wp-block-gallery.has-nested-images {
// Need bogus :not(#individual-image) to override long :not()
Expand Down
3 changes: 2 additions & 1 deletion packages/block-library/src/social-links/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
"allowInheriting": false,
"allowVerticalAlignment": false,
"default": {
"type": "flex"
"type": "flex",
"justifyContent": "left"
}
},
"color": {
Expand Down