Changes between Initial Version and Version 2 of Ticket #59352
- Timestamp:
- 09/14/2023 10:08:54 PM (20 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #59352 – Description
initial v2 1 I found that inserting an inline image in the block editor can result in it erroneously getting `fetchpriority=high` even though it is normally rendered as a small image. When inserting an inline image, the default size (width) is 150 pixels. Nevertheless, the originally uploaded image is actually chosen for the `src` (along with its `width` and `height` and the user-supplied size is added as an inline `width` CSS style. Here is the rendered markup for an inline image appearing as the first image in the content:1 I found that inserting an inline image in the block editor can result in it erroneously getting `fetchpriority=high` even though it is normally rendered as a small image. When inserting an inline image, the default size (width) is 150 pixels. Nevertheless, the originally uploaded image is actually chosen for the `src` (along with its `width` and `height`) and the user-supplied size is added as an inline `width` CSS style. Here is the rendered markup for an inline image appearing as the first image in the content: 2 2 3 3 {{{ … … 20 20 }}} 21 21 22 The `fetchpriority=high` attribute is added to this image even if the immediately-following image is a large image block.22 The `fetchpriority=high` attribute is added to this image even when it is immediately followed by an image block with a large size. 23 23 24 24 To address this, `wp_get_loading_optimization_attributes()` could take into account `$attr['style']` and parse out any `width` property which would override `$attr['width']`. This should address inline images from the block editor, but note it would not account for images that are resized by CSS style rules.