Tiled Gallery missing image size information in output HTML #4440
Labels
[Pri] Medium
Tiled Gallery block
Issues with this label will automatically appear on the project's board
[Type] Bug
Something isn't working
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
To Reproduce
data-height
anddata-width
HTML attributes in each<img>
tagresize
query parameter in the imagesrc
URLsExpected behavior
The
data-height
anddata-width
HTML attributes as well as the imagesrc
URLs should be present, as they are on the web.Smartphone (please complete the following information):
Additional context
The above image shows how the block's HTML on mobile (left side of above image) is missing the
data-height
anddata-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.
The text was updated successfully, but these errors were encountered: