close
Skip to content

Image in navigation overlay can get fetchpriority=high and degrade LCP metric for page #76181

@westonruter

Description

@westonruter

Description

I created a navigation overlay and added an image to it. When viewing the page on the frontend, I found that the IMG in the navigation overlay gets fetchpriority=high even though it is not displayed until the nav menu is opened. In contrast, an actual LCP IMG element (e.g. the featured image of the current post) does not get fetchpriority.

Any IMG in the navigation overlay should get a fetchpriority of low to ensure it is deprioritized in favor of the actual IMG which is identified as

The core logic for adding fetchpriority=high is in wp_get_loading_optimization_attributes().

Step-by-step reproduction instructions

  1. Add a navigation overlay to the .
  2. Add an Image block to the navigation overlay which is at least 250x250 in dimensions (so it has wp_min_priority_img_pixels).
  3. Publish a post with a featured image
  4. Load the post on the frontend, and notice the featured image lacks a fetchpriority attribute whereas the IMG in the navigation overlay has fetchpriority=high.

Screenshots, screen recording, code snippet

Editor

Navigation Block Settings Navigation Overlay Template
Image Image

Frontend with Navigation Collapsed and Expanded

Image Image

Wrong Image Resource Loaded with High Priority

Image

Environment info

  • WordPres 7.0-beta2-61752-src, Gutenberg @ 45bf1fe

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

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions