Media: Ensure images have dimensions to reduce layout shift and facilitate lazy-loading.
This changeset ensures that attachment images which are inserted without `width` and `height` attributes still receive them in the frontend, to reduce cumulative layout shift. Adding the dimensions happens as part of the logic for adding `srcset` and `sizes` attributes, which already assume the specific width and height of the respective image. Images are now only lazy-loaded if they have `width` and `height` attributes present. While missing these attributes itself is what causes layout shifts, lazy-loading such images can make this problem more apparent to the user. Props adamsilverstein, westonruter. Fixes #50367. See #44427. Built from https://develop.svn.wordpress.org/trunk@48170 git-svn-id: https://core.svn.wordpress.org/trunk@47939 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Loading
Please register or sign in to comment