Skip to content

block.json: supports > layout: Add support for setting a default vertical alignment setting #53872

@danieldudzic

Description

@danieldudzic

What problem does this address?

In block.json setting the allowVerticalAlignment to true in the following way:

{
	"supports": {
		"layout": {
			"default": {
				"type": "flex"
			},
			"allowVerticalAlignment": true,
			"allowJustification": false,
			"allowOrientation": false,
			"allowInheriting": false
		}
	}
}

At the moment the default value of the vertical alignment is hardcoded here:

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

Based on the orientation it will be either set to center or top.

It would be useful to be able to set the default to a custom value, like for example bottom in the below case:

Single_Product_‹_Template_‹_Editor_‹_productgallery_—_WordPress

 

In the above case, the default position of the Next/Previous buttons for the Product Image Gallery is bottom, but the default vertical alignment set by Gutenberg is center.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions