Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image: Vertical image from URL cut when displayed in the lightbox #51125

Closed
gziolo opened this issue May 31, 2023 · 2 comments · Fixed by #51206
Closed

Image: Vertical image from URL cut when displayed in the lightbox #51125

gziolo opened this issue May 31, 2023 · 2 comments · Fixed by #51206
Assignees
Labels
[Block] Image Affects the Image Block [Type] Bug An existing feature does not function as intended

Comments

@gziolo
Copy link
Member

gziolo commented May 31, 2023

Description

When using the lightbox behavior for the Image block that contains a vertical image inserted from URL, it displays correctly on the front end. However, when the lightbox gets opened, if the image is tall, then it gets cut on both the top and bottom of the image.

Step-by-step reproduction instructions

  1. Activate the experiment that enables Interactivity API and Behaviors.
  2. Go to the post editor.
  3. Insert an image with a much bigger height than width using Insert from URL option, for example:
    https://pd.w.org/2023/05/7866470b6f485ce37.96403804.jpg.
  4. In the advanced settings for the Image block, activate the lightbox behavior.
  5. Publish the post.
  6. Navigate to the post on the front end.
  7. Open the lightbox and check whether the image is correctly displayed.

Screenshots, screen recording, code snippet

Vertical image in the block editor:

Screenshot 2023-05-30 at 14 50 27

Vertical image in the lightbox on the frontend:
Screenshot 2023-05-30 at 14 50 40

Environment info

  • WordPress 6.2, Gutenberg latest (trunk)

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

@gziolo gziolo added [Type] Bug An existing feature does not function as intended [Block] Image Affects the Image Block labels May 31, 2023
@gziolo gziolo changed the title Image: Vertical image cut when displayed in the lightbox Image: Vertical image from URL cut when displayed in the lightbox May 31, 2023
@gziolo
Copy link
Member Author

gziolo commented May 31, 2023

I was able to reproduce it for an uploaded image.

I set the image size to Large:

Screenshot 2023-05-31 at 12 40 12

View on the site:

Screenshot 2023-05-31 at 12 39 59

View with the lightbox opened:

Screenshot 2023-05-31 at 12 39 39

@SantosGuillamot
Copy link
Contributor

If I am not mistaken this could be solved using max-height: 100% and max-width: 100% (or something similar) here. I can work on a pull request for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Image Affects the Image Block [Type] Bug An existing feature does not function as intended
Projects
None yet
3 participants