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

Tiled Gallery missing image size information in output HTML #4440

Closed
guarani opened this issue Jan 7, 2022 · 1 comment
Closed

Tiled Gallery missing image size information in output HTML #4440

guarani opened this issue Jan 7, 2022 · 1 comment
Labels
[Pri] Medium Tiled Gallery block Issues with this label will automatically appear on the project's board [Type] Bug Something isn't working

Comments

@guarani
Copy link
Contributor

guarani commented Jan 7, 2022

Describe the bug

Removing the hard-coded width and height in Automattic/jetpack#22230 fixes a pixelation issue visually, but the block's HTML output doesn't quite match the web. Also, the Square layout no longer renders as squares on the site's frontend.

Screenshots

Screen Shot 2022-01-05 at 19 48 37

To Reproduce

  1. Add a Tiled Gallery block
  2. Add images to it
  3. Switch to HTML mode
  4. Notice the lack of data-height and data-width HTML attributes in each <img> tag
  5. Notice the lack of resize query parameter in the image src URLs

Expected behavior
The data-height and data-width HTML attributes as well as the image src URLs should be present, as they are on the web.

Smartphone (please complete the following information):

  • Device: any
  • OS: iOS or Android
  • Version: any

Additional context

The above image shows how the block's HTML on mobile (left side of above image) is missing the data-height and data-width HTML attributes that are part of the web output (right of image). Also, the resize query parameter is missing on mobile.

As noted in WordPress/gutenberg#35982 (comment) and WordPress/gutenberg#23244, the root cause of this is that the Image block doesn't set its width and height block attributes unless the user changes these dimensions. In the Tiled Gallery, the inner Image blocks are therefore not exposing their width and height. As of writing this I don't have any workarounds for obtaining these width/height values.

Also, once this is fixed, the hard-coded value of 1000 left in the Mosaic layout's code here might need to be fixed.

The, the web specific code here should add code for mobile, so that size information is serialized when the block is saved in the mobile editor.

@guarani guarani added [Type] Bug Something isn't working Tiled Gallery block Issues with this label will automatically appear on the project's board labels Jan 7, 2022
@guarani
Copy link
Contributor Author

guarani commented Jan 10, 2022

I'm assigning this medium priority in the context of Phase 1B of the project. At time of writing, this issue doesn't appear to cause any issues for the user, but we certainly should default to matching the web's block HTML representation in cases like this where we're unsure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Pri] Medium Tiled Gallery block Issues with this label will automatically appear on the project's board [Type] Bug Something isn't working
Projects
Status: Done (keep clean, manually)
Development

No branches or pull requests

2 participants