Skip to content

Accurate sizes: Image block with center alignment gets wrong sizes #1725

@mukeshpanchal27

Description

@mukeshpanchal27

Summary

When the Image block is set to center alignment, it is constrained by its intrinsic width. However, it should instead be constrained by the contentSize as specified in the CSS.

When image block sets with the center alignment it constrained by contentSize but per current implementation it constrained by image width that needs to be correct.

Core CSS that apply when center alignment sets:

.is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) {
    max-width: var(--wp--style--global--content-size);
    margin-left: auto !important;
    margin-right: auto !important;
}

Steps to Reproduce:

  1. Insert an Image block into a post or page.
  2. Set the image alignment to center.
  3. Observe that the image width is not properly constrained by the contentSize defined in the theme.

Image

Metadata

Metadata

Labels

[Plugin] Enhanced Responsive ImagesIssues for the Enhanced Responsive Images plugin (formerly Auto Sizes)[Type] BugAn existing feature is broken

Type

No type

Projects

Status

Done 😃

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions