Skip to content

Project source image selectors onto canonical core/image markup #662

Description

@chubes4

Problem

The HTML transformer correctly serializes source <img class="photo"> as canonical Gutenberg markup:

<figure class="wp-block-image photo"><img ...></figure>

The authored .photo selector therefore applies to the figure, but image-rendering declarations no longer reach the nested <img>. Fixed width/height, object-fit, and image backgrounds can be correct on the wrapper while the visible image renders at its natural aspect ratio.

Representative browser evidence showed a 123.30 × 106.50 source image and matching WordPress figure, but a 123.28 × 82.19 nested image.

Expected behavior

  • Keep canonical core/image markup and editor validity.
  • Retain the source selector on the figure for box geometry.
  • Project selectors that matched source images onto the canonical nested image.
  • Preserve source selector specificity, including explicit img type selectors and pseudo states.

Acceptance criteria

  • .photo projects to .photo > :where(img) in author stylesheet assets.
  • img.photo projects through the canonical figure without adding noncanonical block attributes.
  • Core/image remains valid canonical markup.
  • Full PHP transformer contract, parity, and package-install suites pass.
  • Representative browser evidence confirms nested image geometry matches its figure/source box.

AI disclosure

Diagnosed and implemented with openai/gpt-5.6-sol.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions