Skip to content

Featured image block: The default aspectRatio set in theme.json doesn't work #69769

@shimotmk

Description

@shimotmk

Description

The default aspectRatio set in theme.json doesn't work

Step-by-step reproduction instructions

  1. Add the following code to the default settings of the block in theme.json.
"core/post-featured-image": {
	"dimensions": {
		"aspectRatio": "1"
	}
},
  1. Go to post or page and place the Featured image block.

  2. You will see that the CSS for the default aspect ratio does not work.

if ( ! empty( $attributes['aspectRatio'] ) ) {
$extra_styles .= 'width:100%;height:100%;';
} elseif ( ! empty( $attributes['height'] ) ) {

Related:#47271

Screenshots, screen recording, code snippet

f.mp4

Environment info

WordPress version: 6.7.2
Twenty Twenty-Five
Gutenberg: version: 20.6.0-rc.1

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Labels

[Block] Post Featured ImageAffects the Post Featured Image Block[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions