Skip to content

Image block lightbox: The enlarged image isn't responsive #55124

Open

Description

@afercia

Description

Splitting this out from #54971

See #54971 (comment)
See #52765 (comment)

The lightbox enlarged image doesn't scale when resizing the window or changing device orientation.

This happens regardless of the initial orientation or window size:

  • When the viewport width gets wider, either by changing orientation from portrait to lanscape or by just increasing the browser iwndow width, the enlarged image keeps the same size. Expected: to be responsive.
  • When the viewport width gets smaller, the enlarged image is cut-off at the edges.

Seems to me this is less than ideal especially on tablets and other small screens. The current behavior isn't great on dsktop either. I'd tend to think all images in WordPress should be responsive and adapt to the available space.

Step-by-step reproduction instructions

  • Creat a post, add an image block and set the image to open in the lightbox.
  • Make sure the image is a large image.
  • Publish and view the front end.
  • Emulate a tablet screen size via your browser dev tools.
  • Open the lightbox
  • Change orientation.
  • Observe the image doesn't scale.
  • Close the lighbox.
  • Change orientation.
  • Open the lightbox
  • Change orientation again.
  • Observe the image doesn't scale.

Screenshots, screen recording, code snippet

When changing device orientation (or resizing the browser window), the image in the open modal dialog doesn't scale correctly:

  • It is either cut-off on the left and right edges
  • Or it doesn't enlarge to take the new available space.

The user experience is less than ideal especially when the image is cut-off on the sides, as some parts of the image aren't visible any longer.

ligthbox scaling

Environment info

No response

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

Activity

  1. added
    [Type] Bug
    [Block] Image
    [Package] Interactivity
    on Oct 6, 2023
  2. jordesign commented on Sep 7, 2026

    @jordesign
    Contributor

    There's reports of this being reproducible again.

    ScreenRecording_08-02-2026.22-46-34_1.MP4
  3. youknowriad commented on Oct 19, 2026

    @youknowriad
    Contributor

    I tested this on WordPress 7.1.2 with Gutenberg trunk (built 2026-10-16), using a 2000x1200 image with the lightbox enabled and resizing or rotating the viewport (768x1024 → 1024x768 → 400px) while the lightbox was open. The enlarged image now resizes to fit the new viewport every time and is no longer cut off. The overlay recalculates its size on window resize since #55212. @jordesign, if the newer reports show something different (a specific theme, image size setting or browser), please share the steps and we can reopen. Closing for now.

  4. youknowriad commented on Oct 19, 2026

    @youknowriad
    Contributor

    Actually reopening this might still happen if you change orientation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Block] Image[Package] Interactivity[Type] Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions